diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index 9cd8954496262..348a4451d3fde 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -71,12 +71,16 @@ def update(*) if partial_updates? # Serialized attributes should always be written in case they've been # changed in place. - super(changed | (attributes.keys & self.class.serialized_attributes.keys)) + super(keys_for_partial_write) else super end end + def keys_for_partial_write + changed | (attributes.keys & self.class.serialized_attributes.keys) + end + def _field_changed?(attr, old, value) if column = column_for_attribute(attr) if column.number? && (changes_from_nil_to_empty_string?(column, old, value) ||