Module: DirtyNestedAttributes::ChangedAssociations

Included in:
ChangesMarker
Defined in:
lib/dirty_nested_attributes/changed_associations.rb

Overview

:nodoc

Instance Method Summary collapse

Instance Method Details

#attribute_change(attr) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/dirty_nested_attributes/changed_associations.rb', line 4

def attribute_change(attr)
  changed_association = association(attr)
  if changed_association && attribute_changed?(attr)
    if changed_association.reflection.collection?
      changed_attributes[attr].map(&:changes)
    else
      changed_attributes[attr].changes
    end
  end
rescue ActiveRecord::AssociationNotFoundError
  super
end