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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, you don’t have to write photo_path(@photo.id), just pass @photo, that’s enough.
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