Files
chatwoot/app/models/concerns/pubsubable.rb
2023-05-06 10:44:52 +05:30

17 lines
388 B
Ruby

# frozen_string_literal: true
module Pubsubable
extend ActiveSupport::Concern
included do
# Used by the actionCable/PubSub Service we use for real time communications
has_secure_token :pubsub_token
end
def pubsub_token
# backfills tokens for existing records
regenerate_pubsub_token if self[:pubsub_token].blank? && persisted?
self[:pubsub_token]
end
end