mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #29941 from kamipo/remove_single_element_array_preprocess
Remove single element array preprocess
This commit is contained in:
commit
eb080d91ce
2 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue