mirror of
https://github.com/github/rails.git
synced 2026-01-09 14:48:01 -05:00
ActiveRecord#attributes optimization: minimize objects created
This commit is contained in:
@@ -181,7 +181,9 @@ module ActiveRecord
|
||||
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user