when I do:
http://localhost:3000/signout
it says:
No route matches [GET] "/signout"
This is because in my routes config file I have:
match '/signout', to: 'sessions#destroy', via: :delete
so my question is whether its possible to send a “delete” request via the URL, so instead of pressing a link:
<%= link_to "Sign out", signout_path, :method => :delete %>
I can mimic the action via URL.
Not really. Although
DELETEis part of the HTTP spec almost all web browsers only know how to makeGETandPOSTrequestes. When you click alink_towith the:deletemethod Rails actually creates a form on the fly and ‘POSTs’ it back to the server. Have a look at the source code.