views:

124

answers:

2

We want to have remember_me enabled when the user signs up. When logging in its really easy to do this, how do to we do this on signup though, as we're literally only creating a User object?

A: 

I assume that the user is logged in automatically once his account is created. Make sure that when you create a session for him for the first time you just pass remember_me as true:

UserSession.create(claimed_user, :remember_me => true)
vise
I tried this and it doesn't seem to help: # Create the User @user = User.new ... @user.save @user_session = UserSession.new(@user, :remember_me => true)As soon as the user closes their browser they are logged out.
Lee
+1  A: 

You can try doing something like this after user creation (worked for me):

current_user_session.remember_me = true
current_user_session.save
Anton Mironov