First, we need to understand which Js package responds to these kinds of alerts in the rails application. Thus, the jquery_ujs package is responsible for displaying warnings in rails.
So you should have jquery & jquery_ujs in your application.js file.
//= require jquery //= require jquery_ujs
Now we need to confirm that the application.js file is included in the required layout or not. By default, the layout file remains in application.html.erb in the view layouts folder.
<%= javascript_include_tag 'application' %>
Then the link should have data-verify & data-method attributes as
<a href="/message/1/reset" data-method="delete" data-confirm="Are you sure?">
In erb it can be written as
= link_to 'Reset', message_path(@message), data: {method: 'delete', confirm: 'Are you sure?'}
This should work if everything is aligned in the same way.
VK Singh Jan 10 '18 at 13:35 2018-01-10 13:35
source share