2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

A safe way to create class variables in a multisite environment.

This should allow plugins to set class variables that will not
stomp on other plugins.
This commit is contained in:
Robin Ward 2017-09-27 12:59:54 -04:00
parent 6700aed8ab
commit 3e13becf33
6 changed files with 103 additions and 21 deletions

View file

@ -1,13 +1,14 @@
# frozen_string_literal: true
require_dependency 'enum'
require_dependency 'multisite_class_var'
class Group < ActiveRecord::Base
include HasCustomFields
include AnonCacheInvalidator
include MultisiteClassVar
cattr_accessor :preloaded_custom_field_names
self.preloaded_custom_field_names = Set.new
multisite_class_var(:preloaded_custom_field_names) { Set.new }
has_many :category_groups, dependent: :destroy
has_many :group_users, dependent: :destroy