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 = :deleteand your “sign_out” code
destroy_user_session_path, :method => :deleteshould work.If it still doesn’t work please comment!
Good luck.