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
109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/temporal_tables/relation_extensions.rb', line 109 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 |