From c4809d9984ab5d20759075a96ddea6096ab93802 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 3 Dec 2010 22:41:54 -0200 Subject: use map instead of each --- activerecord/lib/active_record/base.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') 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 #inspect-like string for the value of the -- cgit v1.2.3