instance method broadcasts_refreshes_to

Ruby on Rails 2.0.23

Since v2.0.23 Last seen in v2.0.23

Signature

broadcasts_refreshes_to(stream)

Configures the model to broadcast a “page refresh” on creates, updates, and destroys to a stream name derived at runtime by the stream symbol invocation. Examples:

class Message < ApplicationRecord
  belongs_to :board
  broadcasts_refreshes_to :board
end

class Message < ApplicationRecord
  belongs_to :board
  broadcasts_refreshes_to ->(message) { [ message.board, :messages ] }
end

Parameters

stream req
Source
# File app/models/concerns/turbo/broadcastable.rb, line 209
    def broadcasts_refreshes_to(stream)
      after_commit -> { broadcast_refresh_later_to(stream.try(:call, self) || send(stream)) }
    end

Defined in app/models/concerns/turbo/broadcastable.rb line 209 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Turbo::Broadcastable::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close