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



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

def dump(obj)
  if text_column?
    ActiveRecord::Coders::YAMLColumn.new(Object).dump(obj)
  else
    obj
  end
end

.load(obj) ⇒ Object



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

def load(obj)
  if text_column?
    ActiveRecord::Coders::YAMLColumn.new(Object).load(obj)
  else
    obj
  end
end

.text_column?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/audited/audit.rb', line 36

def text_column?
  Audited.audit_class.columns_hash["audited_changes"].type.to_s == "text"
end