In versions of Rails previous to 5.1, which used jquery_ujs
, we could replace the browser's confirmation popup with our own by overriding $.rails.allowAction
, as explained here.
As of Rails 5.1+, which uses rails-ujs
, $.rails.allowAction
is no longer available. How can we override Rails' default confirmation with our own in Rails 5 without having to switch back to jquery_ujs
?
Thanks in advance.
I had the same challenge and I looked a little bit more into it. What I found out along the way can be read here: https://medium.com/store2be-tech/how-to-use-sweetalert2-for-your-rails-5-1-rails-ujs-confirms-without-jquery-8a5b516b2a1
Here the final solution: