Sha256: bf177092bf7507cab27bc494ae538407e7b20919802e4cb0a0bf2b720755f3c8
Contents?: true
Size: 755 Bytes
Versions: 4
Compression:
Stored size: 755 Bytes
Contents
module TemporalTables # Uses the time from the "at" field stored in the record to filter queries # made to associations. module AssociationExtensions 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 end end ActiveRecord::Associations::Association.prepend TemporalTables::AssociationExtensions
Version data entries
4 entries across 4 versions & 1 rubygems