ID + Slug name in URL in Rails (like in StackOverflow)
- by Vitaly
Hey,
I'm trying to achieve URLs like this in Rails:
http://localhost/posts/1234/post-slug-name
with both ID and slug name instead of either
http://localhost/posts/1234
or
http://localhost/posts/post-slug-name
(right now I have just slug name in URL, so this part is over). How can I do this?
UPD
I found an article on this: http://augustl.heroku.com/blog/styling-rails-urls, instead of /id/slug it suggests to use /id-slug which works perfectly for me, so I'll go with this.