Getting a form to use :method => :delete (rails)
Mark Needham has a blog post that talks about why :method => delete
in form_for
doesn't work. He says
It turns out that ‘form_for’ expects the ‘:method’ to be provided as part of the right hand most argument as part of a hash with the key ‘:html’.
So you need to change your code from:
<%= form_for(line_item, :method => :delete, :remote => true) do |f| %>
to:
<%= form_for(line_item, :html => { :method => :delete, :remote => true }) do |f| %>
I tried it in a Rails 3.0 application, and the generated HTML was:
<input type="hidden" value="delete" name="_method">