Reputation: 111070
I'm using the following for a delete link:
<%= link_to "Delete", photo_path(@photo.id), :confirm => "Are you sure?", :method=>:delete %>
Problem is, if I click CANCEL - it still deletes!!! wooops... Why is that?
Upvotes: 1
Views: 748
Reputation: 11299
First, you don't have to write photo_path(@photo.id), just pass @photo, that's enough.
<%= link_to "Delete", @photo, :confirm => "Are you sure?", :method => :delete %>
If the link doesn't work, that means that your page doesn't correctly load the JavaScript adaptator for your JavaScript framework. For example, if you use use jQuery, check this :
http://github.com/rails/jquery-ujs
Upvotes: 2