jquery - Ruby on Rails : Delete confirmation pop-up dialog displaying twice -
i facing problem in production server. duplicate of questions questions-answers didn't work me.
i used 'delete' method 'link_to' tag:-
<%= link_to "delete campaign", campaign_path(campaign), :class => "btn btn-danger", :method => :delete, :confirm => 'are sure?'%> when click on "delete campaign" link, getting confirmation pop-up twice. happening on client's production environment only.
using ruby 1.9.2 , rails 3.2.13.
in gemfile, used:-
gem 'jquery-rails' in application.js:-
//= require jquery //= require jquery_ujs //= require bootstrap //= require bootstrap-timepicker //= require_tree ../../../vendor/assets/javascripts/ in application.html.erb:-
<%= javascript_include_tag "application" %> <%= javascript_include_tag "http://code.jquery.com/ui/1.10.2/jquery-ui.js" %> when searched it, found:-
1. config.assets.debug should false in production.rb (it false not working)
2. there should no public/assets directory (no such directory in app)
3. run rake assets:clean on production (no effects)
4. these 2 line should removed application.js:-
//= require jquery
//= require jquery_ujs
last 1 worked me after removing these lines, whole application been affected , jquery event stopped working.
according knowledge either jquery loading twice(but not more 1 javascript_include_tag used) or there problem in "config.assets.compile" true in production.rb
i can't check on local , heroku working fine both.
list of file in vendor/assets/javascripts :-
- bootstrap.js
- bootstrap-datepicker.js
- chai.js
- jquery-cookie.js
- mocha.js
- moment.js
- require.min.js
- text.js
- underscore-amd.js
i encountered same issue in development environment (with rails 3.2.13). i'm using following gem versions (from gemfile.lock): bootstrap-sass (2.3.1.0), sass-rails (3.2.6), jquery-rails (2.2.1). in app/assets/javascripts/application.js:
//= require jquery //= require jquery_ujs //= require bootstrap //= require_tree in application.html.erb:
<%= javascript_include_tag "application" %> in erb template:
<%= button_to 'delete', @card_type, method: :delete, form_class: 'destroy_button', data: { confirm: "are sure?" } %> it appears handler input[data-confirm] getting added twice, once requiring jquery_ujs, , again requiring bootstrap. eliminated double firing of confirmation alert not requiring jquery-ujs, i'm hoping else posts more satisfactory solution.
Comments
Post a Comment