Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Robert McCaffery's Profile

GitHub User: robmc

Comments by Robert McCaffery

Avatar

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.

ruby
  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
Avatar

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?