Couldn't find User with id=sign_out

前端 未结 6 1839
粉色の甜心
粉色の甜心 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:32

    You need to move:

    devise_for :users do get '/users/sign_out' => 'devise/sessions#destroy' 
    

    over your devise_scope. Rails is looking for routes from top of Routes file. Your sign out url matches users/:id, hence it is trying to render show action with sign_out being an id.

    UPDATE:

    Actually, do you really need the last line in your devise_scope block?

提交回复
热议问题