Module: PaperTrailAssociationTracking::Reifier::ClassMethods Private

Included in:
PaperTrail::Reifier
Defined in:
lib/paper_trail_association_tracking/reifier.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#reify(version, options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

See ‘VersionConcern#reify` for documentation.



16
17
18
19
20
21
# File 'lib/paper_trail_association_tracking/reifier.rb', line 16

def reify(version, options)
  options = apply_defaults_to(options, version)
  model = super
  reify_associations(model, options, version)
  model
end

#reify_has_manys(transaction_id, model, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Restore the ‘model`’s has_many associations as they were at version_at timestamp We lookup the first child versions after version_at timestamp or in same transaction.



27
28
29
30
31
32
33
# File 'lib/paper_trail_association_tracking/reifier.rb', line 27

def reify_has_manys(transaction_id, model, options = {})
  assoc_has_many_through, assoc_has_many_directly =
    model.class.reflect_on_all_associations(:has_many).
      partition { |assoc| assoc.options[:through] }
  reify_has_many_associations(transaction_id, assoc_has_many_directly, model, options)
  reify_has_many_through_associations(transaction_id, assoc_has_many_through, model, options)
end