This tag with rails 3
<%= link_to 'Destroy', item, :method => :delete,:confirm=>'Are you sure?' %>
produces this html
<a href="/news/3" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a>
The entry is deleted, the problem is that the popup appears twice.
What could be causing this?
In my case, it was that the application had both "mootools ujs" and "jquery ujs" included. I got rid of the mootools one and now I only see one confirmation.
Great answers here,
But if you did everything and still get those double popups, and if you are running in development mode, check if you have
public/assets
loaded with compiled assets.Deleting
public/assets/*
solves the issue.I've been used to include the
javascript_include_tag
at the bottom of my haml-layout-file.With Rails4 and Turbolinks it happens that:
I solved the problem by moving the
javascript_include_tag
from the bottom into<head>
Try to run either
or
It sounds like the confirmation handler Javascript in rails.js is being attached twice.
Could you be accidentally including two copies of rails.js via duplication of a javascript_include_tag helper?
I've had the same problem with Rails 3.2.12, but simply updating to 3.2.13 solved that problem for me.