Class: AuditLog

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/sequel/plugins/audited.rb

Instance Method Summary collapse

Instance Method Details

#audit_userObject

Obtains the current_user based upon the ‘:audited_current_user_method’ value set in the audited model, either via defaults or via :user_method config options

# NOTE! this allows overriding the default value on a per audited model



29
30
31
32
# File 'lib/sequel/plugins/audited.rb', line 29

def audit_user
  m = Kernel.const_get(associated_type)
  m.send(m.audited_current_user_method) || send(m.audited_current_user_method)
end

#before_validationObject



14
15
16
17
18
19
20
21
# File 'lib/sequel/plugins/audited.rb', line 14

def before_validation
  # grab the current user
  if u = audit_user
    self.modifier = u
  end

  super
end