Sha256: 01de1ee71e4216c033dadf6d7eba3f85e50b84976b628b35c3a78a182a59d0d0

Contents?: true

Size: 732 Bytes

Versions: 11

Compression:

Stored size: 732 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 unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Category::CategoryScheme'

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unidom-category-2.0 app/models/unidom/category/category_scheme.rb
unidom-category-1.6.8 app/models/unidom/category/category_scheme.rb
unidom-category-1.6.7 app/models/unidom/category/category_scheme.rb
unidom-category-1.6.6 app/models/unidom/category/category_scheme.rb
unidom-category-1.6.5 app/models/unidom/category/category_scheme.rb
unidom-category-1.6.4 app/models/unidom/category/category_scheme.rb
unidom-category-1.6.3 app/models/unidom/category/category_scheme.rb
unidom-category-1.6.2 app/models/unidom/category/category_scheme.rb
unidom-category-1.6.1 app/models/unidom/category/category_scheme.rb
unidom-category-1.6 app/models/unidom/category/category_scheme.rb
unidom-category-1.5.5 app/models/unidom/category/category_scheme.rb