Class: Audited::YAMLIfTextColumnType

Inherits:
Object
  • Object
show all
Defined in:
lib/audited/audit.rb

Overview

Audit saves the changes to ActiveRecord models. It has the following attributes:

  • auditable: the ActiveRecord model that was changed

  • user: the user that performed the change; a string or an ActiveRecord model

  • action: one of create, update, or delete

  • audited_changes: a hash of all the changes

  • comment: a comment set with the audit

  • version: the version of the model

  • request_uuid: a uuid based that allows audits from the same controller request

  • created_at: Time that the change was performed

Class Method Summary collapse

Class Method Details

.dump(obj) ⇒ Object


26
27
28
29
30
31
32
# File 'lib/audited/audit.rb', line 26

def dump(obj)
  if Audited.audit_class.columns_hash["audited_changes"].type.to_s == "text"
    ActiveRecord::Coders::YAMLColumn.new(Object).dump(obj)
  else
    obj
  end
end

.load(obj) ⇒ Object


18
19
20
21
22
23
24
# File 'lib/audited/audit.rb', line 18

def load(obj)
  if Audited.audit_class.columns_hash["audited_changes"].type.to_s == "text"
    ActiveRecord::Coders::YAMLColumn.new(Object).load(obj)
  else
    obj
  end
end