Class: Unidom::Category::Categorizing

Inherits:
ApplicationRecord show all
Includes:
Unidom::Common::Concerns::ModelExtension
Defined in:
app/models/unidom/category/categorizing.rb

Class Method Summary collapse

Class Method Details

.categorize!(categorized, into: nil, at: Time.now) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'app/models/unidom/category/categorizing.rb', line 19

def self.categorize!(categorized, into: nil, at: Time.now)

  assert_present! :categorized, categorized
  assert_present! :into,        into
  assert_present! :at,          at

  categorized_is(categorized).category_is(into).valid_at.alive.first_or_create! elemental: true, opened_at: at

end