How to devise destroy session and sign out from controller?

前端 未结 4 821
时光取名叫无心
时光取名叫无心 2021-02-13 02:13

Devise destroy session and sign out from controller?

if something_is_not_kosher
  # 1. log this event, 2. send notice
  redirect_to destroy_user_session_path and         


        
4条回答
  •  囚心锁ツ
    2021-02-13 02:34

    So I ended up solving this by creating a custom signout route

      devise_scope :user do
        get '/signout', to: 'devise/sessions#destroy', as: :signout
      end
    

    and in my controller I have:

    if something_is_not_kosher
      redirect_to signout_path and return
    end
    

提交回复
热议问题