Class: Audited::Sweeper

Inherits:
ActiveModel::Observer
  • Object
show all
Defined in:
lib/audited_logfile.rb

Instance Method Summary collapse

Instance Method Details

#after(controller) ⇒ Object



74
75
76
77
# File 'lib/audited_logfile.rb', line 74

def after(controller)
  self.controller = nil
  Thread.current[:sql_audit_user] = nil
end

#before(controller) ⇒ Object



68
69
70
71
72
# File 'lib/audited_logfile.rb', line 68

def before(controller)
  self.controller = controller
  Thread.current[:sql_audit_user] = current_user
  true
end

#current_userObject



79
80
81
82
83
84
85
86
87
# File 'lib/audited_logfile.rb', line 79

def current_user
  if Audited.current_user_method.is_a? Array
    Audited.current_user_method.map do |method|
      controller.send(method) if controller.respond_to?(method, true)
    end.compact.first
  else
    controller.send(Audited.current_user_method) if controller.respond_to?(Audited.current_user_method, true)
  end
end