Ruby on Rails:为什么确认消息没有出现在“link_to('delete', ...)"中? [英] Ruby on Rails: Why the confirmation message does not appear in "link_to('delete', ...)"?
本文介绍了Ruby on Rails:为什么确认消息没有出现在“link_to('delete', ...)"中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的其中一款产品旁边有以下链接:
I have the following link next to one of my products:
<%= link_to("Delete", {:action => 'destroy', :id => product.id}, :class => 'action', :confirm => 'Are you sure?') %>
但是当我点击它时,确认框没有出现.
but when I click it, the confirmation box does not appear.
生成的 HTML 是:
The generated HTML is:
<a data-confirm="Are you sure ?" class="action" href="/products/destroy/48">Delete</a>
请指教.
推荐答案
<%= link_to("Delete", product, :method => :delete, :class => 'action', :confirm => 'Are you sure?') %>
检查您的javascript_include_tag
它应该可以正常工作:)
check your javascript_include_tag
and it should work fine :)
这篇关于Ruby on Rails:为什么确认消息没有出现在“link_to('delete', ...)"中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文