I have the following problem in Ruby on Rails 3. When I try to use the method link_to in a view with the parameter :method => :delete and an object as usual it works fine.
<%= link_to 'Delete', @car , :confirm => 'Are you sure?',
:method => :delete,
:remote => true %>
The problem shows up 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 %>
It doesn't work, the url is just like a get, and the anchor hasn't got the data-remote and the others attributes from Rails.
So, how could I use my own controller and action with link_to and the delete method?
I have the route in the routes.rb file so I think that isn't the problem.
Thanks in advance.