summaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
blob: ca42aa20eaeb7dacdfda38d8c55ae6fb3447ce75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
  helper_method :current_user, :current_user?

  def current_user(entity_id = params[:entity_id])
    return nil unless session[entity_id].present?
    User.new(session[entity_id].with_indifferent_access)
  end

  def current_user?(entity_id)
    current_user(entity_id).present?
  end
end