Class: Unidom::Category::Categorizing
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Unidom::Category::Categorizing
- Includes:
- Unidom::Common::Concerns::ModelExtension
- Defined in:
- app/models/unidom/category/categorizing.rb
Overview
Categorizing 是分类(category)和被分类项(categorized)之间的关联关系。
Class Method Summary collapse
Class Method Details
.categorize!(category, categorized, opened_at = Time.now) ⇒ Object
15 16 17 |
# File 'app/models/unidom/category/categorizing.rb', line 15 def self.categorize!(category, categorized, opened_at = Time.now) self.categorized_is(categorized).category_is(category).valid_at.alive.first_or_create! elemental: true, opened_at: opened_at end |