diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/application_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5299f54..1eff1a9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,14 +10,18 @@ class ApplicationController < ActionController::Base protected include ApplicationHelper + include AgentsHelper + # Set current agent globally def current_agent - @current_agent = Agent.find_by(name: session[:current_agent] || current_user.presence&.agents&.first&.name || 'incommon') + @current_agent = Agent.find_by(name: current_agent_name) end helper_method :current_agent + # Set current user globally def current_user @current_user ||= User.find_by(external_id: session[:current_user]) if session[:current_user].present? end helper_method :current_user + end |