【发布时间】:2017-03-28 18:18:40
【问题描述】:
更新 - 我刚刚检查过,但都没有确认有效。
我需要对 link_to 进行确认。我已经尝试了 data/confirm 属性的几种变体,但它绕过了确认对话框。
我的链接是
<%= link_to 'new bs line',
:controller => :bedsheet_lines,
:action => :create_new_bedsheet_line,
:data => {:confirm => 'Are you sure that you want to export the Bedsheets?'} %> <br>
这行不通,但是常规的 link_to 可以: 而且这也行不通
<%= link_to "Export Data as a CSV file ",
slitter_bedsheet_export_path(format: "csv"),
:data => {:confirm => 'Are you sure that you want to export the Bedsheets?'} %> <br>
如果我进行检查,则不会显示确认的链接看起来像
<a href="/bedsheet_lines/new_bedsheet_line?
data%5Bconfirm%5D=Are+you+sure+that+you+want+to+export+the+Bedsheets%3F">
new bs line</a> <br>
虽然显示确认的链接看起来像 ,但这项工作也不会消失。
<a data-confirm="Are you sure that you want to export the Bedsheets?"
href="/csv_export.csv">Export Data as a CSV file </a> <br>
我的怀疑是,当您的 link_to 指定操作和控制器时,确认将不起作用。如果这是真的,我应该能够找到解决这个问题的方法。现在我不确定我的问题出在哪里。
【问题讨论】:
标签: ruby-on-rails