Usage: confirm in my link_to helper method in ruby on rails 4 doesn't affect what it ever was. What could be wrong?
This is my link_to method:
<%= link_to 'Dispatch Now', order_path(order["objectId"]), :method => 'delete', :confirm => 'Are you sure?' %>
I looked at my old ruby on rails 3 projects and this is how I triggered the confirmation in my link_to helpers.
It doesn't seem to have any effect.
Did something change with the ruby on rails 4 that might cause it to stop working? I have a jquery-rails file in my gemfile and I checked the application.js file and everything looks fine.
What could be wrong?
source to share
You will need to use:
<%= link_to "Delete", path, method: :delete, data: { confirm: "Are you sure?"} %>
-
Rails 4 changed the syntax so that the attribute is now confirm
processed by a hash data
. If before you could get away with confirm:
, now you need to managedata: { confirm: "your_confirmation" }
source to share