-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question URLs are showing database IDs #330
Comments
Thx Eric, good suggestions - appreciate it - we're just getting around to some of this, happy to have Walter take a look. Our DB of elected officials is still pretty flux-y. But very on-point. |
There are at least three classes where we may want to do this right now:
All three are tricky because the natural "stub url" would be non-unique names or titles. Normally you would deal with this by adding a "scope" (i.e. all question titles must be unique for a jurisdiction), but these three classes using a scope (or scopes, e.g. unique title for person for specific jurisdiction by a particular user) won't work elegantly. We would probably end up with ugly urls anyway. I'll consider it more. I would say that the priority is having a stub url for questions and people. Users are a nice to have. The solution that comes to mind is having a sequence attribute and add that to the title. Possibly timestamp as alternative to sequence. @konklone if you have an alternative approach, I'm all ears. |
If it's helpful, I'm using mongoid-slug to power the URLs for posts on my blog. It uses the database to reflect on whether a slug already exists and appends In other words, I would ignore the uniqueness constraint as an application-level concern, and allow dupe question/people/user names to generate nearly identical slugs, that |
Cool. I had found mongo-slug (and was aware of it), but hadn't caught it handles our situation of non-unique titles and the like. Instead I focused on how you can specify scope, etc. It's actually pretty much what I was suggesting for a sequence attribute. A tad simpler and I'm happy to have it implemented for me! I'll do some experiments and see where it gets us. Thanks for you suggestions. |
Did a little experiment on Question model to see if this is viable right away. Unfortunately it looks like it will take some doing. At least it won't simply "just work" for us without further digging. Too bad! I do think we want to get this relatively soon, but just not in the next couple days probably. A goal is that old URLs still work after the new slug URLs happen. This seems possible with mongoid-slug. |
This URL is, I think, showing a MongoDB database ID:
http://www.askthem.io/dc/questions/52f4fc01f92ea1bb98000009
Whatever it is, I'd turn that into a slug before your formal launch, for a few reasons:
The text was updated successfully, but these errors were encountered: