button_to确认无效

时间:2018-07-02 15:50:31

标签: ruby-on-rails

我无法删除该邮件,请确定。

<td><%= button_to 'Delete',  { action: "destroy", id: profile.id},
    method: :delete, data: {confirm: "Are you sure?"} %>
</td>

当我检查元素时,我得到:

<input name="_method" value="delete" type="hidden">
<input data-confirm="Are you sure?" value="Delete" type="submit">
<input name="authenticity_token" value="tlKQbZ0mI6aQ/pmuAtVdugbMzABI12oRpLoP5UDLmUNGWhzaIi2vYihIXfmUXpo6ruqqLKiCZQcmFOVQQF2n1A==" type="hidden">

这是application.js

//= require rails-ujs
//= require turbolinks
//= require jquery2
//= require jquery-ujs
//= require_tree .

这是宝石 宝石jquery-rails

1 个答案:

答案 0 :(得分:0)

如果您是通过jquery-rails gem安装的,那么我相信

//= require jquery-ujs

应该是

//= require jquery
//= require jquery_ujs

先尝试一下。