I'm a beginner with rails and I want to use Sweet Alert to replace the basic ugly confirm messages on deleting records. I've added sweet-alert gem and sweet-alert-confirm to my gem file I've done exactly what they said in the their Read Me, but It doesn't work, I can delete records but It got deleted right away without any confirm message of any kind.
Gemfile
...
gem 'sweet-alert'
gem 'sweet-alert-confirm'
...
Application.jssupported directives.
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require jquery.turbolinks
//= require bootstrap-sprockets
//= require sweet-alert
//= require sweet-alert-confirm
//= require_tree .
stylesheet.css
/*
...
*= require_self
*= require sweet-alert
*= require_tree .
*/
index.html.erb
...
<%= link_to 'Destroy', ice_cream, method: :delete, data: { confirm: 'Are you sure?' } %>
...
Also, there is somethings I don't know if It worth mention, when I open firebug I find the following error.
Hope you can help me, Thank you.
Thank com unity for the great help!, But yet again I found the answer myself...
Seems there is an issue with the sweetalert gem, So
I uninstalled it using
gem uninstall sweetalert
I installed sweetalert2 using Rails Assets Web Site By Adding the following line to my Gemfile
gem 'rails-assets-sweetalert2', source: 'https://rails-assets.org'
Run bundle
Rearrange application.js
this way
//= require sweetalert2
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require jquery.turbolinks
//= require bootstrap-sprockets
//= require sweet-alert-confirm
//= require_tree .
Rearrange application.css
this way
*= require_self
*= require sweetalert2
*= require_tree .
*/
I kept the sweet-alert-confirm
gem, And every thing worked fine. Now I find this sweet message every time I try to delete a record without adding any lines of code...
Note: please explain why you're voting down a question before you do.