require 'subj_models/concerns/comprising_external_id' module SubjModels module CategoryModule 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 #validates :slug_url, length: { minimum: 4, maximum: 50 }, uniqueness: true, 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 def to_s name end end end