aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2017-07-25 15:41:14 -0400
committerGitHub <noreply@github.com>2017-07-25 15:41:14 -0400
commiteb080d91ce83bad4d0c20d3f1b68e3daa72b04e5 (patch)
treede2c204d98ac35269b811ccb8c9fb7475863d7e9 /activerecord/lib
parent9cbd8890069b0b6f832eb87a38bbcaaad31ca03b (diff)
parent21c0e0e89176b832a286bc6381b6ca2a9a56f1de (diff)
downloadrails-eb080d91ce83bad4d0c20d3f1b68e3daa72b04e5.tar.gz
rails-eb080d91ce83bad4d0c20d3f1b68e3daa72b04e5.tar.bz2
rails-eb080d91ce83bad4d0c20d3f1b68e3daa72b04e5.zip
Merge pull request #29941 from kamipo/remove_single_element_array_preprocess
Remove single element array preprocess
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/preloader/association.rb2
-rw-r--r--activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb
index 1985b38f8a..5ba03c555a 100644
--- a/activerecord/lib/active_record/associations/preloader/association.rb
+++ b/activerecord/lib/active_record/associations/preloader/association.rb
@@ -105,7 +105,7 @@ module ActiveRecord
end
def records_for(ids, &block)
- scope.where(association_key_name => ids.size == 1 ? ids.first : ids).load(&block)
+ scope.where(association_key_name => ids).load(&block)
end
def scope
diff --git a/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb b/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb
index 1bc066363c..b87b5c36dd 100644
--- a/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb
+++ b/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb
@@ -12,7 +12,7 @@ module ActiveRecord
type_to_ids_mapping.map do |type, ids|
{
associated_table.association_foreign_type.to_s => type,
- associated_table.association_foreign_key.to_s => ids.size > 1 ? ids : ids.first
+ associated_table.association_foreign_key.to_s => ids
}
end
end