after_create_commit :broadcast_later private def broadcast_later broadcast_prepend_later_to examiner.identity, :clearances end
# Replace this broadcastable model in the dom for subscribers of the stream name identified by the passed # <tt>streamables</tt>. The rendering parameters can be set by appending named arguments to the call. Examples: # # # Sends <turbo-stream action="replace" target="clearance_5"><template><div id="clearance_5">My Clearance</div></template></turbo-stream> # # to the stream named "identity:2:clearances" # clearance.broadcast_replace_to examiner.identity, :clearances # # # Sends <turbo-stream action="replace" target="clearance_5"><template><div id="clearance_5">Other partial</div></template></turbo-stream> # # to the stream named "identity:2:clearances" # clearance.broadcast_replace_to examiner.identity, :clearances, partial: "clearances/other_partial", locals: { a: 1 } def broadcast_replace_to(*streamables, **rendering) Turbo::StreamsChannel.broadcast_replace_to *streamables, target: self, **broadcast_rendering_with_defaults(rendering) end