ruby -- 问题解决(六)link_to to destroy not working

时间:2021-09-23 14:30:21

在Rails的development环境下开发时,使用link_to进行destroy时顺利进行,最近将环境配置成production时,使用link_to,结果not working

代码如下:

<%= link_to 'Delete User', @user, :confirm => "Are you sure you want to delete?", :method => :delete, :class => "btn btn-danger %>

解决方法如下:将link_to 改为 button_to

<%= button_to 'Delete User', @user, :confirm => "Are you sure you want to delete?", :method => :delete, :class => "btn btn-danger %>

参考链接:http://*.com/questions/4606860/rails-3-link-to-to-destroy-not-working