Class: Mongoid::AuditLog::Entry

Inherits:
Object
  • Object
show all
Includes:
Document, Timestamps::Created
Defined in:
lib/mongoid/audit_log/entry.rb

Instance Method Summary collapse

Instance Method Details

#modifierObject



33
34
35
36
37
38
39
40
# File 'lib/mongoid/audit_log/entry.rb', line 33

def modifier
  @modifier ||= if modifier_id.blank?
                  nil
                else
                  klass = Mongoid::AuditLog.modifier_class_name.constantize
                  klass.find(modifier_id)
                end
end

#modifier=(modifier) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/mongoid/audit_log/entry.rb', line 42

def modifier=(modifier)
  self.modifier_id = if modifier.present? && modifier.respond_to?(:id)
                       modifier.id
                     else
                       modifier
                     end

  @modifier = modifier
end

#valid?Boolean

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/mongoid/audit_log/entry.rb', line 27

def valid?(*)
  result = super
  self.modifier = Mongoid::AuditLog.current_modifier if result
  result
end