Sorry I couldn't phrase the question better. I'm following along the Rails Tutorial by Michael Hartl. It's an amazing book and I understood everything perfectly until this sign_in method
module SessionsHelper
def sign_in(user)
remember_token = User.new_remember_token
cookies.permanent[:remember_token] = remember_token
user.update_attribute(:remember_token, User.encrypt(remember_token))
self.current_user = user
end
......
The helper method is used in SessionsController
class SessionsController < ApplicationController
def create
user = User.find_by(email: params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
sign_in user
redirect_to user
else
flash.now[:error] = 'Invalid email/password combination'
render 'new'
end
end
......
I know self evaluates to the current object and current_user is an attribute. But what is the current object here? Who called sign_in(user)?