mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 04:15:47 +08:00
DEV: Concerns can use class_methods (#24875)
This commit is contained in:
parent
92882d1cc3
commit
497d5b4ca0
|
@ -84,7 +84,7 @@ module HasCustomFields
|
|||
DEFAULT_FIELD_DESCRIPTOR = FieldDescriptor.new(:string, 10_000_000)
|
||||
CUSTOM_FIELDS_MAX_ITEMS = 100
|
||||
|
||||
module ClassMethods
|
||||
class_methods do
|
||||
# To avoid n+1 queries, use this function to retrieve lots of custom fields in one go
|
||||
# and create a "sideloaded" version for easy querying by id.
|
||||
def custom_fields_for_ids(ids, allowed_fields)
|
||||
|
@ -167,8 +167,6 @@ module HasCustomFields
|
|||
end
|
||||
|
||||
included do
|
||||
extend ClassMethods
|
||||
|
||||
has_many :_custom_fields, dependent: :destroy, class_name: "#{name}CustomField"
|
||||
|
||||
validate :custom_fields_max_items, unless: :custom_fields_clean?
|
||||
|
|
Loading…
Reference in New Issue
Block a user