aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods/before_type_cast.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-10-19 12:33:36 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-10-19 12:33:36 -0700
commita49c3b03650b3193cc9440a3b219ab7f19326297 (patch)
treedd68d637a074bc08d1328d780aeb092b2a4c8874 /activerecord/lib/active_record/attribute_methods/before_type_cast.rb
parent028911ad00e7f7733064a80393a1548401bba7af (diff)
parent1ac5cf478825391071d34ec3d7f294fe28c0fceb (diff)
downloadrails-a49c3b03650b3193cc9440a3b219ab7f19326297.tar.gz
rails-a49c3b03650b3193cc9440a3b219ab7f19326297.tar.bz2
rails-a49c3b03650b3193cc9440a3b219ab7f19326297.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods/before_type_cast.rb')
-rw-r--r--activerecord/lib/active_record/attribute_methods/before_type_cast.rb13
1 files changed, 3 insertions, 10 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..74921241f7 100644
--- a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb
+++ b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb
@@ -8,25 +8,18 @@ module ActiveRecord
end
def read_attribute_before_type_cast(attr_name)
- @attributes[attr_name]
+ _attributes.without_typecast[attr_name]
end
# 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
+ _attributes.without_typecast
end
private
# Handle *_before_type_cast for method_missing.
def attribute_before_type_cast(attribute_name)
- if attribute_name == 'id'
- read_attribute_before_type_cast(self.class.primary_key)
- else
- read_attribute_before_type_cast(attribute_name)
- end
+ read_attribute_before_type_cast(attribute_name)
end
end
end