summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-05-26 11:08:18 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2017-05-26 11:08:18 +0200
commit9d40646ad5e7f9a1d30fd72bda1b6abf0dbf1f37 (patch)
treee7620bf863fd6e004b5157484d4006d80fd533db
parent35ab669a957dd63a5c662ba909f368380e3a60c7 (diff)
downloadgitlab-ce-fix-counter-cache-for-acts-as-taggable.tar.gz
Fix Counter Cache not being disabled for acts-on-taggablefix-counter-cache-for-acts-as-taggable
-rw-r--r--changelogs/unreleased/fix-counter-cache-for-acts-as-taggable.yml4
-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]