Sha256: a2ea9430a9bfd3b725a042e790340134417192e68cc1599a453832d33f008f77

Contents?: true

Size: 639 Bytes

Versions: 3

Compression:

Stored size: 639 Bytes

Contents

# Category Scheme 是分类体系。
# 所有者(owner)可以是系统(System)、标准(Standard)、或者某个参与者(Party,如:Person、Shop、Company)。

class Unidom::Category::CategoryScheme < Unidom::Category::ApplicationRecord

  self.table_name = 'unidom_category_schemes'

  include Unidom::Common::Concerns::ModelExtension

  belongs_to :owner,      polymorphic: true
  has_many   :categories, class_name: 'Unidom::Category::Category', foreign_key: :scheme_id

  validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }

  scope :owned_by, ->(owner) { where owner: owner }

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
unidom-category-1.5.3 app/models/unidom/category/category_scheme.rb
unidom-category-1.5.2 app/models/unidom/category/category_scheme.rb
unidom-category-1.5.1 app/models/unidom/category/category_scheme.rb