在我的routes.rb我有这样的补充“设置”作为一个附加动作保险:如何路由名称空间资源的其他操作?
namespace :modules do
namespace :insurance do
resources :insurances do
member do
get :settings
end
end
end
end
据“耙路线”这给以下路径:
settings_modules_insurance_insurance_path
但是,当我访问的浏览器的路径,则返回错误:
No route matches {:action=>"settings", :controller=>"modules/insurance/insurances"}
这是耙路线的全输出继电器:
settings_modules_insurance_insurance GET /modules/insurance/insurances/:id/settings(.:format) {:action=>"settings", :controller=>"modules/insurance/insurances"}
我该怎么办?
官方rails文档实际上建议您不要将资源嵌套深度超过一个等级。你的应用程序将在应用程序/控制器/模块/保险/ insurances_controller.rb – Jon 2012-03-09 08:27:05
寻找一个控制器你是对的,这变得太复杂,并成为配置超过约定,这不是什么Rails是关于。感谢您指出了这一点! – John 2012-03-09 10:09:16