mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Refactor Relation#update a bit to avoid an extra Enumerator instance
This commit is contained in:
parent
b5fc47caf9
commit
32c65d8da3
1 changed files with 1 additions and 1 deletions
|
@ -300,7 +300,7 @@ module ActiveRecord
|
|||
# Person.update(people.keys, people.values)
|
||||
def update(id, attributes)
|
||||
if id.is_a?(Array)
|
||||
id.each.with_index.map {|one_id, idx| update(one_id, attributes[idx])}
|
||||
id.map.with_index { |one_id, idx| update(one_id, attributes[idx]) }
|
||||
else
|
||||
object = find(id)
|
||||
object.update_attributes(attributes)
|
||||
|
|
Loading…
Reference in a new issue