我想调用一个destroy动作。它已经在控制器中定义。
我要销毁的模型是嵌套资源。但路由存在于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"}
我从这个网址调用销毁行动
<%= 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"`
请告诉我一些解决方案。
已经在layouts / application.html.erb
中写了<%= javascript_include_tag :all %>
答案 0 :(得分:1)
我解决了这个问题。
我删除rails.js
和prototype.js
是错误的。
感谢您的光临。很抱歉缺乏信息。