From 969af54af473a52743e1e0d6ed047d9a9194e1a9 Mon Sep 17 00:00:00 2001 From: sin Date: Tue, 20 Aug 2019 00:38:38 +0900 Subject: [PATCH] Commit omission --- lib/acts_as_taggable_on/taggable/core.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/acts_as_taggable_on/taggable/core.rb b/lib/acts_as_taggable_on/taggable/core.rb index ea1698bba..3897a4cbd 100644 --- a/lib/acts_as_taggable_on/taggable/core.rb +++ b/lib/acts_as_taggable_on/taggable/core.rb @@ -53,7 +53,7 @@ def #{tag_type}_list=(new_tags) if Rails.version.to_f < 6.0 set_attribute_was('#{tag_type}_list', #{tag_type}_list) else - d_mutations_from_database.change_to_attribute('#{tag_type}_list') + duplicated_mutations_from_database.change_to_attribute('#{tag_type}_list') end write_attribute("#{tag_type}_list", parsed_new_list) end @@ -69,6 +69,17 @@ def all_#{tags_type}_list def dirtify_tag_list(tagging) attribute_will_change! tagging.context.singularize+"_list" end + + def duplicated_mutations_from_database + unless defined?(@mutations_from_database) + @mutations_from_database = nil + end + @mutations_from_database ||= if defined?(@attributes) + ActiveModel::AttributeMutationTracker.new(@attributes) + else + NullMutationTracker.instance + end + end RUBY end end