diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-02-07 23:23:18 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-02-07 23:41:21 +0000 |
commit | 77b4edce1544f105cc7764249becc1e998b88fc2 (patch) | |
tree | 8e5b3a1a70220ea7abbb3f05e8fccb5abbafb5e3 /activerecord/lib/active_record/attribute_methods | |
parent | b3328779d0ce8e4568e7966099754eae1e5791ad (diff) | |
download | rails-77b4edce1544f105cc7764249becc1e998b88fc2.tar.gz rails-77b4edce1544f105cc7764249becc1e998b88fc2.tar.bz2 rails-77b4edce1544f105cc7764249becc1e998b88fc2.zip |
Fix attribute_before_type_cast for serialized attributes. Fixes #4837.
Conflicts:
activerecord/lib/active_record/core.rb
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/serialization.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb index 2ffd91f796..1798afc3b7 100644 --- a/activerecord/lib/active_record/attribute_methods/serialization.rb +++ b/activerecord/lib/active_record/attribute_methods/serialization.rb @@ -88,6 +88,14 @@ module ActiveRecord super end end + + def read_attribute_before_type_cast(attr_name) + if serialized_attributes.include?(attr_name) + super.unserialized_value + else + super + end + end end end end |