title: How to devise destroy session and sign out from controller?
body: <p>Devise destroy session and sign out from controller?</p>
  
  <pre><code>if something_is_not_kosher
    # 1. log this event, 2. send notice
    redirect_to destroy_user_session_path and return
  end
  </code></pre>
  
  <p>Also tried:</p>
  
  <pre><code>if something_is_not_kosher
   # 1. log this event, 2. send notice
    redirect_to controller: 'devise/sessions', action: 'destroy', method: :delete and return
  end
  </code></pre>
  
  <p>Error is <code>No route matches [GET] "/users/sign_out"</code> but I'm explicitly setting method: :delete in example 2. Maybe devise has a method? <code>current_user.sign_out</code> and tried sign_out(current_user) which also don't work? Thanks for the help.</p>
  
  <p>rake routes:</p>
  
  <pre><code>        new_user_session GET    /users/sign_in(.:format)         devise/sessions#new
              user_session POST   /users/sign_in(.:format)         devise/sessions#create
      destroy_user_session DELETE /users/sign_out(.:format)        devise/sessions#destroy
             user_password POST   /users/password(.:format)        devise/passwords#create
         new_user_password GET    /users/password/new(.:format)    devise/passwords#new
        edit_user_password GET    /users/password/edit(.:format)   devise/passwords#edit
                           PATCH  /users/password(.:format)        devise/passwords#update
                           PUT    /users/password(.:format)        devise/passwords#update
  cancel_user_registration GET    /users/cancel(.:format)          users/registrations#cancel
         user_registration POST   /users(.:format)                 users/registrations#create
     new_user_registration GET    /users/sign_up(.:format)         users/registrations#new
    edit_user_registration GET    /users/edit(.:format)            users/registrations#edit
                           PATCH  /users(.:format)                 users/registrations#update
                           PUT    /users(.:format)                 users/registrations#update
                           DELETE /users(.:format)                 users/registrations#destroy
  </code></pre>