instance method broadcast_after_to

Ruby on Rails 2.0.23

Since v1.3.3 Last seen in v2.0.23

Available in: v1.3.3 v1.4.0 v1.5.0 v2.0.23

Signature

broadcast_after_to(*streamables, target: nil, targets: nil, **rendering)

Insert a rendering of this broadcastable model after the target identified by it’s dom id passed as target for subscribers of the stream name identified by the passed streamables. The rendering parameters can be set by appending named arguments to the call. Examples:

# Sends <turbo-stream action="after" target="clearance_5"><template><div id="clearance_6">My Clearance</div></template></turbo-stream>
# to the stream named "identity:2:clearances"
clearance.broadcast_after_to examiner.identity, :clearances, target: "clearance_5"

# Sends <turbo-stream action="after" target="clearance_5"><template><div id="clearance_6">Other partial</div></template></turbo-stream>
# to the stream named "identity:2:clearances"
clearance.broadcast_after_to examiner.identity, :clearances, target: "clearance_5",
  partial: "clearances/other_partial", locals: { a: 1 }

Parameters

streamables rest
target key = nil
targets key = nil
rendering keyrest
Source
# File app/models/concerns/turbo/broadcastable.rb, line 329
  def broadcast_after_to(*streamables, target: nil, targets: nil, **rendering)
    raise ArgumentError, "at least one of target or targets is required" unless target || targets

    Turbo::StreamsChannel.broadcast_after_to(*streamables, **extract_options_and_add_target(rendering.merge(target: target, targets: targets))) unless suppressed_turbo_broadcasts?
  end

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

Defined in Turbo::Broadcastable

Type at least 2 characters to search.

↑↓ navigate · open · esc close