debian-mirror-gitlab/config/initializers/1_acts_as_taggable.rb

18 lines
794 B
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
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
2017-09-10 17:25:29 +05:30
# validate that counter cache is disabled
2018-03-17 18:26:18 +05:30
raise "Counter cache is not disabled" if
2017-09-10 17:25:29 +05:30
ActsAsTaggableOn::Tagging.reflections["tag"].options[:counter_cache]
2021-09-04 01:27:46 +05:30
2021-12-11 22:18:48 +05:30
# Redirects retrieve_connection to use Ci::ApplicationRecord's connection
[::ActsAsTaggableOn::Tag, ::ActsAsTaggableOn::Tagging].each do |model|
model.connection_specification_name = Ci::ApplicationRecord.connection_specification_name
model.singleton_class.delegate :connection, :sticking, to: '::Ci::ApplicationRecord'
end