bookstore/app/controllers/application_controller.rb

11 lines
226 B
Ruby
Raw Normal View History

2021-03-19 17:31:38 +02:00
class ApplicationController < ActionController::Base
2021-03-20 20:02:37 +01:00
helper_method :current_user
helper_method :logged_in?
def current_user
User.find_by(id: session[:user_id])
end
def logged_in?
!current_user.nil?
end
2021-03-19 17:31:38 +02:00
end