I\'m using devise with my rails 3 app. For some reason the sign in with Remember Me is not working.
Could this be due to testing on localhost:3000 ?
in devis
Do you have the sessions set aswell with config.timeout_in = 10.minutes?
If so see this contribution on stackoverflow which solves it solution
The Devise remember_user_token cookie could be set to 'secure only', in which case it doesn't work with the development rails server on http (browser never sends it back to the server).
Check initializers/devise.rb for rememberable_options = {:secure => true}
This happens because remember_me comes in params as "on", but is compared to Devise::TRUE_VALUES, which are [true, 1, '1', 't', 'T', 'true', 'TRUE'].
The easiest way is to make it work is to insure your remember_me comes as one of that values. Example of check-box(notice value="1"):
<input type="checkbox" name="user[remember_me]" value="1" checked="checked" />
Another way if you want to make it work with "on" value you can add "on" to Devise::TRUE_VALUES. So in your config/initializers/devise.rb just add as the first line:
Devise::TRUE_VALUES << ["on"]
My problem with this was this single line in User.rb (I updated from Michael Hartl login mechanism to devise)
before_save :create_remember_token
I commented it out and it worked.
I also have :
User.rb
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,:token_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
On devise.rb, I only added Devise::TRUE_VALUES << ["on"]
and uncommented config.remember_for = 2.weeks