aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-12-03 22:41:54 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2010-12-05 12:44:14 -0200
commitc4809d9984ab5d20759075a96ddea6096ab93802 (patch)
treedbee813f1dafc04867794a813142fa7eea64615d /activerecord/lib/active_record
parent3ab98cf6e0d399042424d44a788b8bc679b8dd1c (diff)
downloadrails-c4809d9984ab5d20759075a96ddea6096ab93802.tar.gz
rails-c4809d9984ab5d20759075a96ddea6096ab93802.tar.bz2
rails-c4809d9984ab5d20759075a96ddea6096ab93802.zip
use map instead of each
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/base.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index ba7f6f0129..f54c9d118d 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1500,9 +1500,7 @@ MSG
# 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