Reputation: 535
I have some polymorphic_urls which are working ok for actions like new, edit, index, but I need it to destroy action too. Now url's are written like
polymorphic_url [:admin, item], action: :edit, routing_type: :path
I didn't see in docs anything related to destroy action, if there are possibility to call it somehow?
Upvotes: 1
Views: 482
Reputation: 18100
Add :method => :delete
to the show path/url when you use it in link_to. The destroy
url and show
url (as well as update
) are all the same url, just different methods (respectively :delete, :get, :patch) in the request.
The method will show up in the a tag when you use link to.
=link_to polymorphic_url([...], options), :method => :delete
Upvotes: 2