I've set up Devise to authenticate/register users.
But having problems signing them out.
Have this link:
<%= link_to "Sign out", destroy_user_session_path, :method => :delete %>
It looks like this in HTML:
<a href="/users/sign_out">Sign Out</a>
When I click it - get this error:
No route matches [GET] "/users/sign_out"
First, make sure you have <%= javascript_include_tag :defaults %>
in your layout file "application.html.erb."
Then, in your config -> initializers -> "devise.rb" file make sure it says:
config.sign_out_via = :delete
and your "sign_out" code destroy_user_session_path, :method => :delete
should work.
If it still doesn't work please comment!
Good luck.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.