Rails3路由错误。 :method => :删除,这将是“没有路由匹配”

时间:2011-04-02 19:17:26

标签: ruby-on-rails-3 rails-routing

我想调用一个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 %>

Rails 3 link_to (:method => :delete) not working

1 个答案:

答案 0 :(得分:1)

我解决了这个问题。 我删除rails.jsprototype.js是错误的。

感谢您的光临。很抱歉缺乏信息。