2019-10-16 22:18:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Pubsubable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
2019-10-24 20:07:01 +00:00
|
|
|
# Used by the actionCable/PubSub Service we use for real time communications
|
2019-10-16 22:18:48 +00:00
|
|
|
has_secure_token :pubsub_token
|
|
|
|
end
|
2021-11-22 18:02:17 +00:00
|
|
|
|
|
|
|
def pubsub_token
|
|
|
|
# backfills tokens for existing records
|
|
|
|
regenerate_pubsub_token if self[:pubsub_token].blank?
|
|
|
|
self[:pubsub_token]
|
|
|
|
end
|
2019-10-16 22:18:48 +00:00
|
|
|
end
|