class AuditLog

the versioning model

Public Instance Methods

audit_user() click to toggle source

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

# File lib/sequel/plugins/audited.rb, line 25
def audit_user
  m = Kernel.const_get(item_type)
  send(m.audited_current_user_method)
  rescue NoMethodError
  OpenStruct.new(id: "394d9d14-0c8c-4711-96c1-2c3fc90dd671", username: "system", name: "System Migration")
end
before_validation() click to toggle source
Calls superclass method
# File lib/sequel/plugins/audited.rb, line 9
def before_validation
  # grab the current user
  if u = audit_user
    self.user_id    = u.id
    self.username   = u.username
    self.user_type  = u.class.name ||= :User
  end
  super
end