diff options
author | Stan Hu <stanhu@gmail.com> | 2017-05-26 18:15:27 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-05-26 18:15:27 +0300 |
commit | bd259d6bab4b3c9856be6c3d2e0c16e0836c9380 (patch) | |
tree | 60210dd04871bf8195c5cf2fa064d0c9685cc55d | |
parent | 2eb3a40567ba63015e2cdcb2ce2fa762c367fe05 (diff) | |
parent | 9d40646ad5e7f9a1d30fd72bda1b6abf0dbf1f37 (diff) |
Merge branch 'fix-counter-cache-for-acts-as-taggable' into 'master'
Fix Counter Cache not being disabled for acts-on-taggable
Closes #30582
See merge request !11727
-rw-r--r-- | changelogs/unreleased/fix-counter-cache-for-acts-as-taggable.yml | 4 | ||||
-rw-r--r-- | config/initializers/0_acts_as_taggable.rb (renamed from config/initializers/acts_as_taggable.rb) | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/changelogs/unreleased/fix-counter-cache-for-acts-as-taggable.yml b/changelogs/unreleased/fix-counter-cache-for-acts-as-taggable.yml new file mode 100644 index 00000000000..e40668546c0 --- /dev/null +++ b/changelogs/unreleased/fix-counter-cache-for-acts-as-taggable.yml @@ -0,0 +1,4 @@ +--- +title: Fix counter cache for acts as taggable +merge_request: +author: diff --git a/config/initializers/acts_as_taggable.rb b/config/initializers/0_acts_as_taggable.rb index c564c0cab11..54e9fcc31db 100644 --- a/config/initializers/acts_as_taggable.rb +++ b/config/initializers/0_acts_as_taggable.rb @@ -3,3 +3,7 @@ ActsAsTaggableOn.strict_case_match = true # tags_counter enables caching count of tags which results in an update whenever a tag is added or removed # since the count is not used anywhere its better performance wise to disable this cache ActsAsTaggableOn.tags_counter = false + +# validate that counter cache is disabled +raise "Counter cache is not disabled" if + ActsAsTaggableOn::Tagging.reflections["tag"].options[:counter_cache] |