Sha256: c8744d186f87ac7faf6dcd4b4a778dea5b84fb31de44bc2d3e5713bdf9b7c626

Contents?: true

Size: 626 Bytes

Versions: 1

Compression:

Stored size: 626 Bytes

Contents

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

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

  self.table_name = 'unidom_category_schemes'

  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 }

  include ::Unidom::Common::Concerns::ModelExtension

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unidom-category-0.1 app/models/unidom/category/category_scheme.rb