Add session helpers

This commit is contained in:
Trevor Vallender 2023-08-08 20:29:01 +01:00
parent 0915c65dc8
commit dde5b3a5d6
1 changed files with 9 additions and 0 deletions

View File

@ -1,2 +1,11 @@
# frozen_string_literal: true
module ApplicationHelper
def logged_in?
session[:user_id].present?
end
def current_user
@current_user ||= User.find(session[:user_id]) if logged_in?
end
end