Module: TemporalTables::AssociationExtensions
- Defined in:
- lib/temporal_tables/association_extensions.rb
Overview
Uses the time from the “at” field stored in the record to filter queries made to associations.
Instance Method Summary collapse
Instance Method Details
#target_scope ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/temporal_tables/association_extensions.rb', line 7 def target_scope # Kludge: Check +public_methods+ instead of using +responds_to?+ to # bypass +delegate_missing_to+ calls, as in +ActiveStorage::Attachment+. # Using responds_to? results in an infinite loop stack overflow. if @owner.public_methods.include?(:at_value) # If this is a history record but no at time was given, # assume the record's effective to date super.at(@owner.at_value || @owner.eff_to) else super end end |