Class: TalkingStick::Participant

Inherits:
ApplicationRecord show all
Defined in:
app/models/talking_stick/participant.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.remove_stale!(room) ⇒ Object



14
15
16
# File 'app/models/talking_stick/participant.rb', line 14

def remove_stale!(room)
  self.where(room_id: room.id).where('last_seen < ?', Time.now - 15.seconds).destroy_all
end

Instance Method Details

#set_defaultsObject



8
9
10
11
# File 'app/models/talking_stick/participant.rb', line 8

def set_defaults
  self.joined_at ||= Time.now
  self.last_seen ||= self.joined_at
end