提交 aa2bfd69 编写于 作者: J José Valim 提交者: José Valim

Merge pull request #6687 from tiegz/3-2-optimizations

ActiveRecord#attributes optimization: minimize objects created
上级 066e6c66
......@@ -149,7 +149,9 @@ def attribute_names
# Returns a hash of all the attributes with their names as keys and the values of the attributes as values.
def attributes
Hash[@attributes.map { |name, _| [name, read_attribute(name)] }]
attrs = {}
attribute_names.each { |name| attrs[name] = read_attribute(name) }
attrs
end
# Returns an <tt>#inspect</tt>-like string for the value of the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册