Class: Unidom::Category::Categorizing

Inherits:
ActiveRecord::Base
  • Object
show all
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!(categorized, into: nil, at: Time.now) ⇒ Object

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



19
20
21
# File 'app/models/unidom/category/categorizing.rb', line 19

def self.categorize!(categorized, into: nil, at: Time.now)
  categorized_is(categorized).category_is(into).valid_at.alive.first_or_create! elemental: true, opened_at: at
end