Couldn't find User with id=sign_out

前端 未结 6 1793
粉色の甜心
粉色の甜心 2021-01-04 15:19

Sign-out link isn\'t working in my rails application.

I have checked my routes.rb which is listed below and my application.html.erb looks to follow the right path.

6条回答
  •  孤街浪徒
    2021-01-04 15:44

    If you are calling /users/sign_out directly from the URL it won't work because the routes is:

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

    id est, it uses the DELETE method. You need to change your devise initializer to:

    config.sign_out_via = :get
    

    other option would be to create a small form and its button with DELETE as method.

提交回复
热议问题