views:

569

answers:

2

As my understanding on nested resources, on edge Rails, should not

link_to 'User posts', @user.posts

point to

/users/:id/posts

?

The routes.rb file contains

map.resources :users, :has_many => :posts

If this is not the default behavior, can it be accomplished doing something else?

+2  A: 

This should work:

 
 link_to "User Posts", user_posts_path(@user)

for more details visit:

http://guides.rubyonrails.org/routing.html

Rishav Rastogi
+2  A: 

Along the same lines as Rishav:

link_to "User Posts", [@user, :posts]
Ryan Bigg