1
在我的routes.rb我:Rails的嵌套資源和路徑
resources :boards do
resources :items
end
現在
在板#表明我要顯示一個鏈接到http://mysite/baord/:board_id/items/new
,運行rake routes
我得到:
new_board_item GET /boards/:board_id/items/new(.:format) items#new
和所以我應該可以使用new_board_item_path
但這隻適用於site.com/board/:board_id/items,但我想在board中使用此鏈接#show action,但它告訴我:
No route matches {:action=>"new", :controller=>"items"}
雖然這不是真的!
你的主板傳遞到板項目?例如。 new_board_item_path(@board) – 2012-03-28 15:47:21
我的錯誤錯誤是...如果您將評論轉換爲答案,我會接受它 – 2012-03-28 15:51:02
很高興我能幫上忙! :) – 2012-03-28 15:59:39