Module: TemporalTables::AbstractReflectionExtensions

Defined in:
lib/temporal_tables/reflection_extensions.rb

Overview

This is required for eager_load to work in 6.1

Instance Method Summary collapse

Instance Method Details

#join_scope(table, foreign_table, foreign_klass) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/temporal_tables/reflection_extensions.rb', line 6

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