Module: TemporalTables::PreloaderExtensions
- Defined in:
- lib/temporal_tables/relation_extensions.rb
Overview
Uses the at time when fetching preloaded records
Instance Method Summary collapse
Instance Method Details
#build_scope ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/temporal_tables/relation_extensions.rb', line 123 def build_scope # It seems the at time can be in either of these places, but not both, # depending on when the preloading happens to be done at_time = @owners.first.at_value if @owners.first.respond_to?(:at_value) at_time ||= Thread.current[:at_time] if at_time super.at(at_time) else super end end |