我想调用破坏动作。它已经在控制器中定义。我要销毁的模型是嵌套资源。但是路径存在于rake routes
结果中。
new_content_model GET /contents/:content_id/model/new(.:format) {:controller=>"models", :action=>"new"}
edit_content_model GET /contents/:content_id/model/:id/edit(.:format) {:controller=>"models", :action=>"edit"}
content_model PUT /contents/:content_id/model/:id(.:format) {:controller=>"models", :action=>"update"}
DELETE /contents/:content_id/model/:id(.:format) {:controller=>"models", :action=>"destroy"}
我从这个 url 调用破坏动作
<%= link_to "destroy nested model", content_model_path( @content.id, @model.id ), :confirm => "are you sure?", :method => :delete %>
没有路线匹配。
Routing Error
No route matches "/contents/1/model/1"`
请告诉我一些解决方案。
已经写<%= javascript_include_tag :all %>
在 layouts/application.html.erb