Module: UserImpersonate::DeviseHelpers::UrlHelpers

Defined in:
lib/user_impersonate/devise_helpers.rb

Instance Method Summary collapse

Instance Method Details

#current_staff_userObject



22
23
24
25
26
27
28
# File 'lib/user_impersonate/devise_helpers.rb', line 22

def current_staff_user
  return unless session[:staff_user_id]
  user_finder_method = (UserImpersonate::Engine.config.user_finder || "find").to_sym
  user_class_name = UserImpersonate::Engine.config.user_class || "User"
  user_class = user_class_name.constantize
  @staff_user ||= user_class.send(user_finder_method, session[:staff_user_id])
end