提交 32c65d8d 编写于 作者: C Carlos Antonio da Silva

Refactor Relation#update a bit to avoid an extra Enumerator instance

上级 b5fc47ca
......@@ -300,7 +300,7 @@ def update_all(updates)
# 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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册