Skip to content

Commit

Permalink
Use changed_attributes instance variable for processing dirty objects…
Browse files Browse the repository at this point in the history
… in ActiveRecord 4.2

changed_attributes method is frozen, so cannot be modified.

From mbleigh#583
  • Loading branch information
calvinhughes committed Jul 21, 2020
1 parent 2e01cdb commit 24d9275
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/acts_as_taggable_on/taggable/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,13 @@ def process_dirty_object(context, new_list)
if changed_attributes.include?(attrib)
# The attribute already has an unsaved change.
old = changed_attributes[attrib]
changed_attributes.delete(attrib) if old.to_s == value.to_s
@changed_attributes.delete(attrib) if old.to_s == value.to_s
else
old = tag_list_on(context)
if self.class.preserve_tag_order
changed_attributes[attrib] = old if old.to_s != value.to_s
@changed_attributes[attrib] = old if old.to_s != value.to_s
else
changed_attributes[attrib] = old.to_s if old.sort != ActsAsTaggableOn.default_parser.new(value).parse.sort
@changed_attributes[attrib] = old.to_s if old.sort != ActsAsTaggableOn.default_parser.new(value).parse.sort
end
end
end
Expand Down

0 comments on commit 24d9275

Please sign in to comment.