Skip to content
Browse files

No need to use inject here, use map instead.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
1 parent 4513cc1 commit 0580f5a6ac78340ececb43981c6731817c1031aa @miloops miloops committed with spastorino Sep 22, 2010
Showing with 1 addition and 4 deletions.
  1. +1 −4 activerecord/lib/active_record/attribute_methods/before_type_cast.rb
View
5 activerecord/lib/active_record/attribute_methods/before_type_cast.rb
@@ -13,10 +13,7 @@ def read_attribute_before_type_cast(attr_name)
# 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

0 comments on commit 0580f5a

Please sign in to comment.
Something went wrong with that request. Please try again.