I have the following problem in Ruby on Rails 3. When I try to use the link_to method in a view with the parameter: method =>: delete and the object, as usual, it works fine.
<%= link_to 'Delete', @car , :confirm => 'Are you sure?', :method => :delete, :remote => true %>
The problem occurs when I try to use my own controller and action:
<%= link_to 'Delete', :id => @car.id, :confirm => 'Are you sure?', :controller => 'truck', :action => 'my_destroy', :method => :delete, :remote => true %>
This does not work, the URL is similar to get, and the binding has no data-removed and other attributes from Rails.
So, how can I use my own controller and action using link_to and the delete method?
I have a route in the routes.rb file, so I think this is not a problem.
Thanks in advance.
source share