diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-21 14:15:33 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-21 14:41:13 -0300 |
commit | f2e0925ab7279c5a7c0a5ba7574a09d9e5550fd0 (patch) | |
tree | 3139061d63f66a667b3a6a5948c249c38059db4a /activerecord/lib/active_record/attribute_methods | |
parent | aefcd342c4c447f471e285ff666fa1ced7f11754 (diff) | |
download | rails-f2e0925ab7279c5a7c0a5ba7574a09d9e5550fd0.tar.gz rails-f2e0925ab7279c5a7c0a5ba7574a09d9e5550fd0.tar.bz2 rails-f2e0925ab7279c5a7c0a5ba7574a09d9e5550fd0.zip |
Serialized attribute can be serialized in an integer column
Fix #8575
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 47d4a938af..25d62fdb85 100644 --- a/activerecord/lib/active_record/attribute_methods/serialization.rb +++ b/activerecord/lib/active_record/attribute_methods/serialization.rb @@ -112,6 +112,14 @@ module ActiveRecord end end + def _field_changed?(attr, old, value) + if self.class.serialized_attributes.include?(attr) + old != value + else + super + end + end + def read_attribute_before_type_cast(attr_name) if self.class.serialized_attributes.include?(attr_name) super.unserialized_value |