I wanted to add confirmation message on link_to function with Ruby.
= link_to \'Reset message\', :action=>\'reset\' ,:confirm=>\'Are you sure?\'
First, we need to understand what Js package respond to this kind of alerts in rails application. So for this, jquery_ujs package is reponsible for showing the alerts in rails.
So you must have jquery & jquery_ujs in your application.js file.
//= require jquery
//= require jquery_ujs
Now, we need to confirm, that application.js file is included in your required layout or not. By default layout file remains in application.html.erb in layout folder of views.
<%= javascript_include_tag 'application' %>
Next the link should have data-confirm & data-method attributes as
In erb, this 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 same fashion.