7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/subj_models/category.rb', line 7
def self.included(including_class)
including_class.class_eval do
include SubjModels::ComprisingExternalId
has_many :nomenclatures
belongs_to :image, class_name: "DocumentFile"
belongs_to :image_big, class_name: "DocumentFile"
validates :name, presence: true
scope :by_slug_url, -> slug_url { where(slug_url: slug_url) }
scope :is_public, -> condition { where(is_public: condition) }
scope :by_id, -> ids { where(id: ids) }
scope :exclude_by_id, -> ids { where.not(id: ids) }
end
end
|