Why Rails “link_to” does not work for delete action?

蹲街弑〆低调 提交于 2019-11-29 04:11:29

Do you have rails.js specified in a javascript_include_tag? This is required for the unobtrusive DELETE method to work. If you're using jQuery then there's a solution for that too.

Dont forget to include jquery_ujs in your application.js file:

//
//= require jquery
//= require jquery_ujs
// ...

It needs to be product_path(product) instead of product in your delete link.

I had same problem - actually I had changed my old 'delete' action to 'destroy' - but forgot If your using SSL.. (e.g ssl_required :destroy)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!