我有一個資源:產品中的命名空間:商店,就像這樣:如何在rails 3中的命名空間中的資源上指定操作?
namespace :shop do
resources :products
root :to => 'products#index'
end
當運行rake routes
它輸出以下內容:
edit_shop_product GET /shop/products/:id/edit(.:format) {:action=>"edit", :controller=>"shop/products"}
但是,當我使用edit_shop_product_path
的局部視圖,像這樣:
<%= button_to "Edit", edit_shop_product_path(product) %>
我得到一個ActionController的例外:No route matches "/shop/products/1/edit"
我錯過了什麼?
所有這些都已到位。索引,新建和創建操作按預期工作。這只是在渲染視圖時出現此錯誤的編輯操作失敗。 感謝您的回覆,但! – harald 2010-05-19 07:04:41
這很奇怪。它應該工作。 – 2010-05-19 07:24:25
這就是我的想法:)=我會看看我是否有更多時間在本週末進行調試。 – harald 2010-05-19 11:18:03