Reputation: 15609
logout GET /logout(.:format) devise/sessions#destroy
This is the route I am interested in.
However, when I go to /logout, I get this error:
No route matches [DELETE] "/logout"
, how do I change this route from get
to delete
?
This is how my route is currently set up:
get 'logout', to: 'devise/sessions#destroy', as: :logout
and my link:
<%= link_to "Sign Out", logout_path, method: :delete %>
Upvotes: 0
Views: 160
Reputation: 74
Change:
get 'logout', to: 'devise/sessions#destroy', as: :logout
to:
delete 'logout', to: 'devise/sessions#destroy', as: :logout
You can find more information on routing on this page: Routing Rails Guide
Upvotes: 5