Sasha
Sasha

Reputation: 3281

devise admin logging out error

i had an issue with devise. whenever i try to log out as an admin with devise, i get the following error

No route matches [GET] "/admins/sign_out"

doing rake routes, i see it has

destroy_admin_session DELETE /admins/sign_out(.:format) devise/sessions#destroy

and in my views i call it as...

<%= link_to  "sign out as admin", destroy_admin_session_path %>

am i supposed to override the admins controller for devise? it seems strange to me that i can go to... /admins/sign_in. however, going to /admins/sign_out doesn't work.

i created the admin using the admin model format.

https://github.com/plataformatec/devise/wiki/How-To:-Add-an-Admin-role

did anyone else experience this issue as an admin in devise?

thanks

Upvotes: 3

Views: 1141

Answers (1)

kevinhyunilkim
kevinhyunilkim

Reputation: 864

It looks like the sign out URL requires DELETE HTTP method.

<%= link_to  "sign out as admin", destroy_admin_session_path, method: :delete %>

would work.

Upvotes: 3

Related Questions