Add session helpers
This commit is contained in:
parent
0915c65dc8
commit
dde5b3a5d6
|
@ -1,2 +1,11 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ApplicationHelper
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue