aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-09-22 11:07:31 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-09-22 18:08:02 -0300
commit0580f5a6ac78340ececb43981c6731817c1031aa (patch)
treef27c54354a119cb40eb6739d6b17ba60ef126a29 /activerecord
parent4513cc142c2cce675ea5fa63926950dc240e9aac (diff)
downloadrails-0580f5a6ac78340ececb43981c6731817c1031aa.tar.gz
rails-0580f5a6ac78340ececb43981c6731817c1031aa.tar.bz2
rails-0580f5a6ac78340ececb43981c6731817c1031aa.zip
No need to use inject here, use map instead.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/attribute_methods/before_type_cast.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb
index a4e144f233..23195b02f7 100644
--- a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb
+++ b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb
@@ -13,10 +13,7 @@ module ActiveRecord
# Returns a hash of attributes before typecasting and deserialization.
def attributes_before_type_cast
- self.attribute_names.inject({}) do |attrs, name|
- attrs[name] = read_attribute_before_type_cast(name)
- attrs
- end
+ Hash[attribute_names.map { |name| [name, read_attribute_before_type_cast(name)] }]
end
private