Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 376
Sasha Avatar asked Jul 01 '26 07:07

Sasha


1 Answers

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.

like image 138
kevinhyunilkim Avatar answered Jul 03 '26 21:07

kevinhyunilkim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!