This tag with rails 3
<%= link_to \'Destroy\', item, :method => :delete,:confirm=>\'Are you sure?\' %>
produces this html
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?
In my case jQuery was loaded twice because of the line
//= require_tree .
To prevent this error in application.js and application.css I'm used to create a subdirectory app/assets/javascript/autorequire
and instead of require_tree .
I do require_tree ./autorequire
.
So, files in app/assets/javascript
and app/assets/stylesheets
are not included automatically/accidentally anymore. I put all my individual .css and .js files into the subdirectory and they are included implicitly. But I can define which files from the top-path are to be included and in which order.
Since I do so, I never had troubles by assets not loaded as I expect them to be.
I'm using Rails 4 and none of the answers worked for me, however the following worked... I changed the line:
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
to
<%= javascript_include_tag 'application', 'data-turbolinks-eval' => false %>.
https://github.com/rails/turbolinks/issues/244
I've had the same problem with Rails 3.2.12, but simply updating to 3.2.13 solved that problem for me.
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.
In the layout haml like this have the twice pop up problem
%head
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
%body
#calendar.calendarsize
Then I commend it and it works.
%head
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
-#= javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
%body
#calendar.calendarsize