tap/app/helpers/sessions_helper.rb

15 lines
215 B
Ruby
Raw Normal View History

2014-11-06 18:30:53 +01:00
module SessionsHelper
def log_in(user)
session[:user_id] = user.id
end
def current_user
@current_user ||= User.find_by(id: session[:user_id])
end
def logged_in?
!current_user.nil?
end
end