instance method
broadcast_render
Ruby on Rails 1.3.3
Since v1.3.3 Last seen in v2.0.23Signature
broadcast_render(**rendering)
Render a turbo stream template with this broadcastable model passed as the local variable. Example:
# Template: entries/_entry.turbo_stream.erb <%= turbo_stream.remove entry %> <%= turbo_stream.append "entries", entry if entry.active? %>
Sends:
<turbo-stream action="remove" target="entry_5"></turbo-stream> <turbo-stream action="append" target="entries"><template><div id="entry_5">My Entry</div></template></turbo-stream>
…to the stream named “entry:5”.
Note that rendering inline via this method will cause template rendering to happen synchronously. That is usually not desireable for model callbacks, certainly not if those callbacks are inside of a transaction. Most of the time you should be using broadcast_render_later, unless you specifically know why synchronous rendering is needed.
Parameters
-
renderingkeyrest
Source
# File app/models/concerns/turbo/broadcastable.rb, line 302
def broadcast_render(**rendering)
broadcast_render_to self, **rendering
end
Defined in app/models/concerns/turbo/broadcastable.rb line 302
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Turbo::Broadcastable