Rearranging parts of the URL result from link_to in Rails

Posted by mathee on Stack Overflow See other posts from Stack Overflow or by mathee
Published on 2010-06-02T01:30:10Z Indexed on 2010/06/02 1:33 UTC
Read the original article Hit count: 283

Filed under:
|
|

This is how I'm doing it now:

link_to "Profile", :controller => "profiles", :action => "asked", :id => @profile
# => <a href="/profiles/asked/1">Profile</a>

Does it make more sense for the URL to be <a href="/profiles/1/asked">Profile</a>? Profile 1 asked some number of questions, so it makes more sense to me for the URL to look like: /:controller/:id/:action.

If you agree, how do I accomplish this?

If you don't agree, please let me know why. (I'm new to Ruby on Rails, so I'm still getting used to MVC conventions.)

Any advice would be great!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routes