title: Undelete acts_as_paranoid deleted user on devise sign in
body: <p>I have a Rails 3.1.3 app which uses <code>devise</code> for users authentication and soft-deletes them with <code>acts_as_paranoid</code>. I want the accounts to be undeleted upon password recreation, user sign up and user sign in, so if they provide a deleted email, I grab that account, make it live again, and then continue with the action (password recreation, or sign in).</p>
  
  <p>But in the <code>Users::SessionsController#create</code> action, after undeletion of the user it gets an Unauthorized error (but the user should now be visible). The code is:</p>
  
  <pre><code>def create
    # Take into account acts_as_paranoid deleted users
    resource = resource_class.only_deleted.find_by_email(params[resource_name][:email])
    resource.undelete! if resource
  
    resource = warden.authenticate!(:scope =&gt; resource_name, :recall =&gt; "#{controller_path}#new")
    set_flash_message(:notice, :signed_in) if is_navigational_format?
    sign_in(resource_name, resource)
    respond_with resource, :location =&gt; after_sign_in_path_for(resource)
  end
  </code></pre>
  
  <p>If I add a <code>resource.reload</code> call after the undeletion it doesn't change anything. And if I sign in again, user gets normally signed in, as it got undeleted in the previous attempt.</p>
  
  <p>Why is this happening? How can I get it undeleted and signed in in a single <code>create</code> call?</p>