简体   繁体   中英

Devise sign out path is taking me to Users#show

Does anyone have any insight to this, its as the title says. Ive not altered to devise code or anything like that but all of a sudden i cant sign out anymore. it just takes me to Users/show

<%= link_to "delete",  :controller => "devise/sessions", :action => "destroy" %>

<%= link_to "Logout", destroy_user_session_path, method: :delete  %></li>

routes:

 devise_for :users, controllers: {
 registrations: 'users/registrations',
 omniauth_callbacks: "users/omniauth_callbacks"

}

When clicked it takes me to http://localhost:3000/users/sign_out this path but its actually the User#show page

This is from rails routes:

destroy_user_session DELETE   /users/sign_out(.:format)                 devise/sessions#destroy

The only way to sign out is by closing the browser to delete the cookie then i can sign back in

Looks like your links are set up correctly. I'd be willing to be that you have some Javascript hiding somewhere that's targeting that link (perhaps there is a class on it that is used in an on('click') somewhere).

If that's the case, try adding preventDefault() to that Javascript so that the default link click behavior is ignored.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM