title: Devise - Invalid Email or Password with valid information
body: <p>I'm encountering an interesting issue when signing in/out users with devise. I can sign up users just fine, but once I sign out for the first time, I can no longer sign back in (even though I'm using the same email/password combination I just signed up with). It gives me an invalid email or password error. Has anyone ever experienced this and solved it?</p>
  
  <p>Here's some code:</p>
  
  <p>user.rb</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    # Include default devise modules. Others available are:
    # :token_authenticatable, :confirmable,
    # :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable
  
    # Setup accessible (or protected) attributes for your model
    attr_accessible :email, :password, :password_confirmation, :remember_me
    # attr_accessible :title, :body
  end
  </code></pre>
  
  <p>routes.rb</p>
  
  <pre><code>ChsInventory::Application.routes.draw do
    devise_for :users
    resources :items
    resources :subjects do
      resources :items_in_stock
    end
  
    root to: 'items#index'
  end
  </code></pre>
  
  <p>_nav.html.erb (where the sign-in, sign-out link is)</p>
  
  <pre><code>&lt;ul class="nav pull-right"&gt;
    &lt;% if current_user %&gt;
      &lt;li&gt;&lt;%= link_to 'Sign out', destroy_user_session_path, method: "delete" %&gt;&lt;/li&gt;
    &lt;% else %&gt;
      &lt;li&gt;&lt;%= link_to 'Sign in', new_user_session_path %&gt;&lt;/li&gt;
    &lt;% end %&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>_form.html.erb</p>
  
  <pre><code>&lt;%= form_tag url: '/users/sign_in', method: 'POST', :html =&gt; { :class =&gt; 'form-horizontal' } do |f| %&gt;
    &lt;div class="control-group"&gt;
      &lt;%= label_tag :signup, 'Email', :class =&gt; 'control-label' %&gt;
      &lt;div class="controls"&gt;
        &lt;%= text_field_tag :signup, nil, :class =&gt; 'text_field' %&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="control-group"&gt;
      &lt;%= label_tag :signup, 'Password', :class =&gt; 'control-label' %&gt;
      &lt;div class="controls"&gt;
        &lt;%= password_field_tag :signup, nil, :class =&gt; 'password' %&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="form-actions"&gt;
      &lt;%= link_to t('.cancel', :default =&gt; t("helpers.links.cancel")), root_path, :class =&gt; 'btn' %&gt;
      &lt;%= submit_tag nil, :class =&gt; 'btn btn-primary' %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Here's the output when I run 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
                             PUT    /users/password(.:format)                               devise/passwords#update
    cancel_user_registration GET    /users/cancel(.:format)                                 devise/registrations#cancel
           user_registration POST   /users(.:format)                                        devise/registrations#create
       new_user_registration GET    /users/sign_up(.:format)                                devise/registrations#new
      edit_user_registration GET    /users/edit(.:format)                                   devise/registrations#edit
                             PUT    /users(.:format)                                        devise/registrations#update
                             DELETE /users(.:format)                                        devise/registrations#destroy
  </code></pre>
  
  <p>Thanks in advance</p>