Permalink
Browse files

use map instead of each

  • Loading branch information...
1 parent 3ab98cf commit c4809d9984ab5d20759075a96ddea6096ab93802 @spastorino spastorino committed Dec 4, 2010
Showing with 1 addition and 3 deletions.
  1. +1 −3 activerecord/lib/active_record/base.rb
@@ -1500,9 +1500,7 @@ def attributes=(new_attributes, guard_protected_attributes = true)
# Returns a hash of all the attributes with their names as keys and the values of the attributes as values.
def attributes
- attrs = {}
- attribute_names.each { |name| attrs[name] = read_attribute(name) }
- attrs
+ Hash[attribute_names.map { |name| [name, read_attribute(name)] }]
end
# Returns an <tt>#inspect</tt>-like string for the value of the

0 comments on commit c4809d9

Please sign in to comment.