Module: UserImpersonate::ApplicationHelper

Defined in:
app/helpers/user_impersonate/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_staff_userObject



3
4
5
6
7
8
9
# File 'app/helpers/user_impersonate/application_helper.rb', line 3

def current_staff_user
  return unless session[:staff_user_id]
  staff_finder_method = config_value(UserImpersonate::Engine.config, :staff_finder, 'find').to_sym
  staff_class_name = config_value(UserImpersonate::Engine.config, :staff_class, 'User')
  staff_class = staff_class_name.constantize
  @staff_user ||= staff_class.send(staff_finder_method, session[:staff_user_id])
end