RailsCasts Pro episodes are now free!

Learn more or hide this

Louis Muhammad's Profile

GitHub User: lmuhammad1

Comments by Louis Muhammad

Avatar

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

Avatar

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)

users_controller.rb
def create
    @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?

Louis