Sha256: e70c64233c571b452b38d6f7388e47057e71cc3c784d2c4a0e8fa59fa36e29df
Contents?: true
Size: 715 Bytes
Versions: 3
Compression:
Stored size: 715 Bytes
Contents
# Recognization 是访问者识别,用于维护访问者和参与者的对应关系。 class Unidom::Visitor::Recognization < ActiveRecord::Base self.table_name = 'unidom_recognizations' belongs_to :visitor, polymorphic: true belongs_to :party, polymorphic: true scope :visitor_is, ->(visitor) { where visitor: visitor } scope :party_is, ->(party) { where party: party } include Unidom::Common::Concerns::ModelExtension def self.cognize(visitor, party) raise 'Visitor can not be null.' if visitor.blank? raise 'Party can not be null.' if party.blank? recognization = visitor_is(visitor).party_is(party).first_or_create elemental: true, opened_at: Time.now end end
Version data entries
3 entries across 3 versions & 1 rubygems