Great episode. When a person creates a new account, there is no remember me functionality and his session is not automatically stored after creating a new account.
In episode #270, you showed us how to accomplish this by adding the following code (and adding : session[:user_id] = @user.id)
users_controller.rb
defcreate@user = User.new(params[:user])
if@user.save
session[:user_id] = @user.id
redirect_to root_url, notice:"Thank you for signing up!"else
render "new"end
How would we accomplish this being that we are not using the session and we are now using the cookie?
I figured it out :). I knew it was something easy.
needed to replace:
session[:user_id] = @user.id
with:
cookies[:auth_token] = @user.auth_token
Ryan,
Great episode. When a person creates a new account, there is no remember me functionality and his session is not automatically stored after creating a new account.
In episode #270, you showed us how to accomplish this by adding the following code (and adding :
session[:user_id] = @user.id)
How would we accomplish this being that we are not using the session and we are now using the cookie?
Louis