Sha256: 09e6653103e1081419720936f4d977130b103ea042ca0be96da518dca66ee917

Contents?: true

Size: 622 Bytes

Versions: 8

Compression:

Stored size: 622 Bytes

Contents

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

class Unidom::Category::CategoryScheme < ActiveRecord::Base

  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

8 entries across 8 versions & 1 rubygems

Version Path
unidom-category-1.5 app/models/unidom/category/category_scheme.rb
unidom-category-1.4 app/models/unidom/category/category_scheme.rb
unidom-category-1.3 app/models/unidom/category/category_scheme.rb
unidom-category-1.2 app/models/unidom/category/category_scheme.rb
unidom-category-1.1 app/models/unidom/category/category_scheme.rb
unidom-category-1.0 app/models/unidom/category/category_scheme.rb
unidom-category-0.3 app/models/unidom/category/category_scheme.rb
unidom-category-0.2 app/models/unidom/category/category_scheme.rb