Rails3 路由错误。 :方法=> :delete, 这将是“没有路由匹配”
我想发起破坏行动。它已经在控制器中定义了。 我想要销毁的模型是嵌套资源。但路由存在于rake paths
结果中。
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 调用 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 %>
I want to call a destroy action. It is already define in controller.
The model that I want to destroy is nested resource. But route is existing in rake routes
result.
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"}
And I call destroy action from this url
<%= link_to "destroy nested model", content_model_path( @content.id, @model.id ), :confirm => "are you sure?", :method => :delete %>
It is no route matches.
Routing Error
No route matches "/contents/1/model/1"`
Please tell me some solutions.
Already wrote <%= javascript_include_tag :all %>
in layouts/application.html.erb
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了这个问题。
我删除了
rails.js
和prototype.js
是错误的。感谢您的出席。抱歉,缺乏信息。
I solved this problem.
It was wrong that I deleted
rails.js
andprototype.js
.Thank you for your attending. Sorry for lack of information.