Skip to content

Commit

Permalink
Merge pull request #265 from ifad/chore/remove-legacy-check
Browse files Browse the repository at this point in the history
Remove instance method check on Preloader
  • Loading branch information
tagliala authored Feb 2, 2024
2 parents 0249b42 + a5e06d2 commit 02af493
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/chrono_model/patches/relation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 02af493

Please sign in to comment.