In a form, I have:
= link_to "Delete toy", @toy, :method => :delete, :confirm => "Are you sure?", :class => "btn btn-danger"
This generates the following html:
<a href="/toys/258" class="btn btn-danger" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Delete toy</a>
However, when I click the link, I simply get taken back to the show page of the toy. (I don’t get the confirm popup either.) What am I doing wrong?
I added a = javascript_include_tag :all and = javascript_include_tag "application" inside my application.html.haml, per the recommendation a bunch of the other posts on SO about this exact question, but it didn’t help.
UPDATE: this is what is in my application.js file:
//= require jquery
//= require jquery_ujs
//= require_tree .
Remove the
= javascript_include_tag :allpart of your layout. This is probably loading jQuery-UJS twice, the second overwriting all configured listeners.With the asset pipeline, you’ll only ever need to include “application”, and never all the other files.
(same happens with the stylesheets)