title: Devise Unlock Button in Views
body: <p>This is probably very simple and I'm overlooking it. I am using devise lockable functions and I would like to create a button that an admin can check to unlock a locked user.</p>
  
  <p>Devise has a model method called <a href="https://github.com/plataformatec/devise/blob/547e18e24e7141d65357d97210bcb342161ca2b7/lib/devise/models/lockable.rb" rel="noreferrer">unlock_access!</a>. I am trying to call it in my users' controller method with a button in the views.</p>
  
  <p><em>Views:</em></p>
  
  <pre><code>= link_to('unlock', user_unlock_path(user), method: :post, class: 'button-xs') unless user == current_user
  </code></pre>
  
  <p><em>users_controller.rb:</em></p>
  
  <pre><code>def unlock
    user = User.find(params[:id])
    user.unlock_access!
  end
  </code></pre>
  
  <p><em>route</em></p>
  
  <pre><code>resources :users do
    post 'unlock'
  end
  </code></pre>