diff --git a/lib/chrono_model/patches/relation.rb b/lib/chrono_model/patches/relation.rb index 5d31b99..56eee6f 100644 --- a/lib/chrono_model/patches/relation.rb +++ b/lib/chrono_model/patches/relation.rb @@ -5,17 +5,15 @@ module Patches module Relation include ChronoModel::Patches::AsOfTimeHolder - if ActiveRecord::Associations::Preloader.instance_methods.include?(:call) - def preload_associations(records) # :nodoc: - preload = preload_values - preload += includes_values unless eager_loading? - scope = StrictLoadingScope if strict_loading_value - - preload.each do |associations| - ActiveRecord::Associations::Preloader.new( - records: records, associations: associations, scope: scope, model: model, as_of_time: as_of_time - ).call - end + def preload_associations(records) # :nodoc: + preload = preload_values + preload += includes_values unless eager_loading? + scope = StrictLoadingScope if strict_loading_value + + preload.each do |associations| + ActiveRecord::Associations::Preloader.new( + records: records, associations: associations, scope: scope, model: model, as_of_time: as_of_time + ).call end end