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 :)