Reputation: 5270
in my routes.rb I have:
resources :boards do
resources :items
end
now in boards#show I want to show a link to http://mysite/baord/:board_id/items/new
, running rake routes
I get:
new_board_item GET /boards/:board_id/items/new(.:format) items#new
and so I should be able to use new_board_item_path
but this works only from site.com/board/:board_id/items but i want to use this link in boards#show action but it tells me that:
No route matches {:action=>"new", :controller=>"items"}
while that's not true!
Upvotes: 1
Views: 289
Reputation: 1836
Pass the parent resource into the path, so in this case:
new_board_item_path(@board)
Upvotes: 1