diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index ef629dcb3b..8b30a48c1c 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -681,9 +681,10 @@ module ActiveRecord @records = eager_loading? ? find_with_associations.freeze : @klass.find_by_sql(arel, bound_attributes, &block).freeze preload = preload_values - preload += includes_values unless eager_loading? - preloader = build_preloader + preload += includes_values unless eager_loading? + preloader = nil preload.each do |associations| + preloader ||= build_preloader preloader.preload @records, associations end |