Sha256: dc7ada65037a2ed3841c7a13828c60a801632e1b1d7ba9103eb8a4f610780348

Contents?: true

Size: 584 Bytes

Versions: 9

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

module TemporalTables
  # This is required for eager_load to work in 6.1
  module AbstractReflectionExtensions
    def join_scope(table, foreign_table, foreign_klass)
      constraint = super
      at_value = Thread.current[:at_time]

      return constraint unless at_value

      constraint.where(klass.build_temporal_constraint(at_value))
    end
  end
end

prepend_reflection = ActiveRecord.version > ::Gem::Version.new('6.1.0')
ActiveRecord::Reflection::AbstractReflection.prepend TemporalTables::AbstractReflectionExtensions if prepend_reflection

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
temporal_tables-3.0.2 lib/temporal_tables/reflection_extensions.rb
temporal_tables-3.0.1 lib/temporal_tables/reflection_extensions.rb
temporal_tables-3.0.0 lib/temporal_tables/reflection_extensions.rb
temporal_tables-3.0.0.pre.rc.1 lib/temporal_tables/reflection_extensions.rb
temporal_tables-2.0.0 lib/temporal_tables/reflection_extensions.rb
temporal_tables-1.1.0 lib/temporal_tables/reflection_extensions.rb
temporal_tables-1.0.3 lib/temporal_tables/reflection_extensions.rb
temporal_tables-1.0.2 lib/temporal_tables/reflection_extensions.rb
temporal_tables-1.0.1 lib/temporal_tables/reflection_extensions.rb