Module: TemporalTables::AssociationExtensions

Defined in:
lib/temporal_tables/relation_extensions.rb

Overview

Uses the time from the “at” field stored in the record to filter queries made to associations.

Instance Method Summary collapse

Instance Method Details

#target_scopeObject



94
95
96
97
98
99
100
101
102
# File 'lib/temporal_tables/relation_extensions.rb', line 94

def target_scope
	if @owner.respond_to?(: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