Skip to content

Commit

Permalink
move logic for determining which attributes should be saved into own …
Browse files Browse the repository at this point in the history
…method so that it can be overwritten

also read rails#8328 (comment)
  • Loading branch information
lacco committed Dec 9, 2015
1 parent d94d77c commit 6c4245d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion activerecord/lib/active_record/attribute_methods/dirty.rb
Expand Up @@ -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) ||
Expand Down

0 comments on commit 6c4245d

Please sign in to comment.