Class: Unidom::Visitor::Identificating

Inherits:
ApplicationRecord show all
Includes:
Common::Concerns::ModelExtension
Defined in:
app/models/unidom/visitor/identificating.rb

Overview

Identificating 是身份关联,存储身份(identity)和访问者(visitor)之间的关联关系。

Class Method Summary collapse

Class Method Details

.find_identity(visitor) ⇒ Object



20
21
22
# File 'app/models/unidom/visitor/identificating.rb', line 20

def self.find_identity(visitor)
  visitor_is(visitor).first.try :identity
end

.identificate!(visitor, as: nil, at: Time.now) ⇒ Object



27
28
29
# File 'app/models/unidom/visitor/identificating.rb', line 27

def self.identificate!(visitor, as: nil, at: Time.now)
  self.visitor_is(visitor).identity_is(as).valid_at.alive.first_or_create! opened_at: at
end