Module: TinyDyno::Changeable

Extended by:
ActiveSupport::Concern
Included in:
DocumentComposition
Defined in:
lib/tiny_dyno/changeable.rb

Overview

Defines behaviour for dirty tracking.

Since:

  • 4.0.0

Instance Method Summary collapse

Instance Method Details

#changesHash<String, Array<Object, Object> ] The changes.

Get all the changes for the document.

Examples:

Get all the changes.

model.changes

Returns:

  • (Hash<String, Array<Object, Object> ] The changes.)

    Hash<String, Array<Object, Object> ] The changes.

Since:

  • 2.4.0



42
43
44
45
46
47
48
49
50
# File 'lib/tiny_dyno/changeable.rb', line 42

def changes
  _changes = {}
  changed.each do |attr|
    next if attr.nil?
    change = attribute_change(attr)
    _changes[attr] = change
  end
  _changes
end