views:

1074

answers:

1

If I want to provide an alias for a controller, I can use map.resources :rants, :controller => 'blog_posts' yoursite.com/rants points to the blog_posts controller fine.

How do I give an alias to a nested resource, for example yoursite.com/users/5/rants ?

+1  A: 

You may want to try:

 map.resources :rants, :controller => 'blog_posts'
 map.resources :users do |users|
   users.resources :rants, :controller => 'blog_posts'
 end

This will give you the yoursite.com/users/5/rants/ url that you are looking for and it will generate the handy methods (for example: users_rants_path(@user))

Hope this helps.

vrish88
This was driving me crazy.Thank you, thank you, thank you, thank you!
Kirschstein