From a5e06d2937f4789dfee28fa1ee241b3599e395e9 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 2 Feb 2024 17:51:55 +0100 Subject: [PATCH] Remove instance method check on Preloader this method is included in the minimum required Rails version, so the check is redundant --- lib/chrono_model/patches/relation.rb | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) 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