I’ve got a table of projects in my Rails app, each with a delete link, like so:
<%= link_to "Delete", project, :confirm => "Are you sure?", :method => :delete %>
However, the delete request is sent even if the user clicks “Cancel” on the dialog box.
Any ideas on how to fix this? I’m using Rails 3, Beta 3, with the jQuery library and accompanying jQuery UJS library.
You need to get a more recent version of rails.js. I was having the same problem using the same setup you have. When I diff’d the old and new versions, I discovered the confirmation handler in the old version was commented out. The new version solves the problem.