Search code examples
jqueryhtmlruby-on-railsturbolinks

Rails confirmation pop-up appears multiple times


I have a delete button for my view. When I try to delete an entity, confirmation message appears three times. I have checked the location of "javascript_include_tag" and it is in the head section.

<%= link_to activity_path(activity), method: :get, :id => "button", :class => "btn btn-info btn-sm btn-icon icon-left" do %>
 <i class="entypo-info">
</i>Show <% end %>

And this is my application.js

//= require jquery-1.11.0.min
//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require main-gsap
//= require jquery-ui-1.10.3.minimal.min.js
//= require bootstrap
//= require joinable
//= require resizeable
//= require neon-api
//= require turbolinks
//= require jquery-jvectormap-1.2.2.min.js
//= require jquery.sparkline.min
//= require d3.v3
//= require rickshaw.min
//= require raphael-min
//= require morris.min
//= require toastr
//= require neon-custom
//= require neon-chat
//= require neon-demo

Solution

  • It was a basic mistake and I found the problem in my code. "javascript_include_tag" was used in my index.html.erb and also application.html.erb. This duplication caused javascript to run multiple times and confirmation pop-up to appear several times.