Sha256: b4169ea26a48b3a914abcb9d3ae02093e710c267111cd7c469cb759986c0be6a

Contents?: true

Size: 568 Bytes

Versions: 1

Compression:

Stored size: 568 Bytes

Contents

# Categorizing 是分类(category)和被分类项(categorized)之间的关联关系。

class Unidom::Category::Categorizing < ::ActiveRecord::Base

  self.table_name = 'unidom_categorizings'

  belongs_to :category,    class_name:  'Unidom::Category::Category'
  belongs_to :categorized, polymorphic: true

  scope :category_is,    ->(category)    { where category_id: (category.respond_to?(:id) ? category.id : category) }
  scope :categorized_is, ->(categorized) { where categorized: categorized }

  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/categorizing.rb