Class: Unidom::Category::CategoryRollup
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Unidom::Category::CategoryRollup
- Includes:
- Unidom::Common::Concerns::ModelExtension
- Defined in:
- app/models/unidom/category/category_rollup.rb
Overview
Category Rollup 是分类的层级关系。
Class Method Summary collapse
Class Method Details
.roll_up!(ancestor_category, descendant_category, opened_at = Time.now) ⇒ Object
31 32 33 |
# File 'app/models/unidom/category/category_rollup.rb', line 31 def self.roll_up!(ancestor_category, descendant_category, opened_at = Time.now) self.descendant_category_is(descendant_category).ancestor_category_is(ancestor_category).valid_at.alive.first_or_create! opened_at: opened_at end |