Browsers usually support the GET and POST HTTP methods. To emulate the verbs PUT and DELETE, Rails introduces a special _method parameter when submitting the form.
You define the method you want to use by passing the :method parameter, just like you do.
<%= link_to("Action with DELETE", path_to_something, :method => :delete) %> <%= link_to("Action with PUT", path_to_something, :method => :put) %>
If not specified, the default value is GET .
Starting with Rails 3, Rails uses unobtrusive JavaScript to handle the DELETE method. It passes the HTTP verb in the data-method attribute, which is an HTML 5 function .
In your case, this does not work, because you probably forgot to include the JavaScript library (for example, Prototype or jQuery) and the Rails adapter.
Make sure you use jQuery or Prototype, and you include the rails.js javascript file. Also, be sure to add csrf_meta_tag .
<%= csrf_meta_tag %>
If you want to learn how to move, I wrote an article about unobtrusive JavaScript in Rails 3 a few months ago.
source share