在我的routes.rb中,我将此添加“设置”作为保险的附加操作:
namespace :modules do
namespace :insurance do
resources :insurances do
member do
get :settings
end
end
end
end
根据“rake routes”,这给出了以下路径:
settings_modules_insurance_insurance_path
但是当我在浏览器中访问该路径时,它会返回错误:
No route matches {:action=>"settings", :controller=>"modules/insurance/insurances"}
这是rake路线的全部输出:
settings_modules_insurance_insurance GET /modules/insurance/insurances/:id/settings(.:format) {:action=>"settings", :controller=>"modules/insurance/insurances"}
我该怎么办?
答案 0 :(得分:0)
您已将新路线设置为会员,因此您必须传递保险的ID:
settings_modules_insurance_insurance_path(@insurance)
答案 1 :(得分:0)
控制器的全名应该是Modules :: Insurance :: InsurancesController,对吗?