aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/preloader/association.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb
index e11a5cfb8a..91e7f90739 100644
--- a/activerecord/lib/active_record/associations/preloader/association.rb
+++ b/activerecord/lib/active_record/associations/preloader/association.rb
@@ -107,7 +107,7 @@ module ActiveRecord
@preloaded_records = slices.flat_map do |slice|
records_for(slice)
end
- @preloaded_records.group_by do |record|
+ @preloaded_records.group_by do |record|
convert_key(record[association_key_name])
end
end
@@ -139,6 +139,10 @@ module ActiveRecord
scope.order!(order_values)
end
+ if group_values = preload_values[:group] || values[:group]
+ scope.group!(group_values)
+ end
+
if preload_values[:reordering] || values[:reordering]
scope.reordering_value = true
end