Reputation: 14868
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 ?
Upvotes: 3
Views: 2961
Reputation: 21447
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.
Upvotes: 4