最初没有确认。
我发现添加//= query_ujs
到我的资产歧管解决了这个问题。但是......现在我发现确认对话框需要“2次点击”才能使用(取消或确定按钮)。
我的清单如下所示:
//= require jquery
//= require jquery-ui
//
// ujs needed for delete confirm dial boxes.
//= require jquery_ujs
无论是取消还是确定,都需要点击两次。删除按钮的 Rails 代码
= button_to '', schedule_path(schedule),
:method => 'delete',
:confirm => 'Are you sure you want to delete this schedule?',
:class => 'deleteicon',
:title => "Delete #{name}"
生成的 HTML:
<form action="/schedule/719" class="button_to" method="post">
<div>
<input name="_method" value="delete" type="hidden">
<input class="deleteicon" data-confirm="Are you sure you want to delete this schedule?" title="Delete Shedule A" value="" type="submit">
<input name="authenticity_token" value="wpcofEiLu6NXymHj289XGahTTT1XqNI56XvBlAFq2G8=" type="hidden">
</div>
</form>
页面标题的js:
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery-ui.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script>