aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-07-26 02:59:39 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-07-26 03:03:28 +0900
commit21c0e0e89176b832a286bc6381b6ca2a9a56f1de (patch)
tree585c235cb12d8f752dee4db1997151fcd06a7e83 /activerecord
parentc146065b8df8b3893b9ae33111987d5f1c18d457 (diff)
downloadrails-21c0e0e89176b832a286bc6381b6ca2a9a56f1de.tar.gz
rails-21c0e0e89176b832a286bc6381b6ca2a9a56f1de.tar.bz2
rails-21c0e0e89176b832a286bc6381b6ca2a9a56f1de.zip
Remove single element array preprocess
Since 213796f, array predicate handler supports making binds, so the preprocess is no longer needed.
Diffstat (limited to 'activerecord')
-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