【问题标题】:Rails3 Routing Error. :method => :delete, It will be "no route matches"Rails3 路由错误。 :method => :delete, 这将是“没有路由匹配”
【发布时间】:2011-04-02 19:17:26
【问题描述】:

我想调用销毁操作。它已经在控制器中定义。 我要销毁的模型是嵌套资源。但是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"`

请告诉我一些解决方案。


已经在 layouts/application.html.erb 中写了&lt;%= javascript_include_tag :all %&gt;

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

【问题讨论】:

  • 我看不出有什么明显的错误。接下来我会在尝试点击链接后查看日志,看看是否有任何有用的信息。

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


【解决方案1】:

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

感谢您的出席。抱歉信息不足。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多