RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: robmc
This took me a while to figure out as well. You want to add the session line to your users controller and point it wherever you are taking your users once they log in.
def create @user = User.new(params[:user]) if @user.save session[:user_id] = @user.id redirect_to some_path, :notice => "Signed up!" else render "new" end end
I tried to add the cookie line because I would like to automatically log in after signup as well but I am getting the error:
NoMethodError in UsersController#create
undefined method `auth_token' for #< User:0x9a89d60 >
Am I missing something?
This took me a while to figure out as well. You want to add the session line to your users controller and point it wherever you are taking your users once they log in.
I tried to add the cookie line because I would like to automatically log in after signup as well but I am getting the error:
NoMethodError in UsersController#create
undefined method `auth_token' for #< User:0x9a89d60 >
Am I missing something?