Merge pull request #29941 from kamipo/remove_single_element_array_preprocess

Remove single element array preprocess
This commit is contained in:
Sean Griffin 2017-07-25 15:41:14 -04:00 committed by GitHub
commit eb080d91ce
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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