class Turbo::Streams::TagBuilder
Experimental RBS support (using type sampling data from the type_fusion
project).
# tmp/gems/turbo-rails/1.4.0/data/app/models/turbo/streams/tag_builder.rbs class Turbo::Streams::TagBuilder def initialize: (#<Class:0x000000010fb94398> view_context) -> void end
<% end %>
<%= link_to topic_merge.topic.name, topic_path(topic_merge.topic) %>
<%= turbo_stream.append dom_id(topic_merge) do %>
<% # app/views/topics/merges/_merge.turbo_stream.erb %>
Or you can render the HTML that should be part of the update inline:
<% end %>
<%= render partial: “entries/entry”, locals: { entry: entry } %>
<% # format is automatically switched, such that _entry.html.erb partial is rendered, not _entry.turbo_stream.erb %>
<%= turbo_stream.append “entries” do %>
<%= turbo_stream.remove entry %>
<% # app/views/entries/_entry.turbo_stream.erb %>
Or string several separate updates together:
<% end %>
<%= turbo_stream.remove posting %>
<% @postings.each do |posting| %>
<% # app/views/postings/destroy.turbo_stream.erb %>
turbo stream templates. This object plays together with any normal Ruby you’d run in an ERB template, so you can iterate, like:
This tag builder is used both for inline controller turbo actions (see Turbo::Streams::TurboStreamsTagBuilder
) and for
def action(name, target, content = nil, allow_inferred_rendering: true, **rendering, &block)
def action(name, target, content = nil, allow_inferred_rendering: true, **rendering, &block) template = render_template(target, content, allow_inferred_rendering: allow_inferred_rendering, **rendering, &block) turbo_stream_action_tag name, target: target, template: template end
def action_all(name, targets, content = nil, allow_inferred_rendering: true, **rendering, &block)
def action_all(name, targets, content = nil, allow_inferred_rendering: true, **rendering, &block) template = render_template(targets, content, allow_inferred_rendering: allow_inferred_rendering, **rendering, &block) turbo_stream_action_tag name, targets: targets, template: template end
def after(target, content = nil, **rendering, &block)
<%= turbo_stream.after "clearance_5" do %>
<%= turbo_stream.after clearance, partial: "clearances/clearance", locals: { title: "Hello" } %>
<%= turbo_stream.after clearance %>
<%= turbo_stream.after "clearance_5", "
the content in the block, or the rendering of the target as a record after the target in the dom. Examples:
Insert the content passed in, a rendering result determined by the rendering keyword arguments,
def after(target, content = nil, **rendering, &block) action :after, target, content, **rendering, &block end
def after_all(targets, content = nil, **rendering, &block)
<%= turbo_stream.after_all "clearance_item" do %>
<%= turbo_stream.after_all clearance, partial: "clearances/clearance", locals: { title: "Hello" } %>
<%= turbo_stream.after_all clearance %>
<%= turbo_stream.after_all ".clearance_item", "
the content in the block, or the rendering of the target as a record after the targets in the dom. Examples:
Insert the content passed in, a rendering result determined by the rendering keyword arguments,
def after_all(targets, content = nil, **rendering, &block) action_all :after, targets, content, **rendering, &block end
def append(target, content = nil, **rendering, &block)
<%= turbo_stream.append "clearances" do %>
<%= turbo_stream.append "clearances", partial: "clearances/unique_clearance", locals: { clearance: clearance } %>
<%= turbo_stream.append "clearances", clearance %>
<%= turbo_stream.append "clearances", "
or the rendering of the content as a record. Examples:
rendering result determined by the rendering keyword arguments, the content in the block,
Append to the target in the dom identified with target either the content passed in or a
def append(target, content = nil, **rendering, &block) action :append, target, content, **rendering, &block end
def append_all(targets, content = nil, **rendering, &block)
<%= turbo_stream.append_all ".clearances" do %>
<%= turbo_stream.append_all ".clearances", partial: "clearances/new_clearance", locals: { clearance: clearance } %>
<%= turbo_stream.append_all ".clearances", clearance %>
<%= turbo_stream.append_all ".clearances", "
or the rendering of the content as a record. Examples:
rendering result determined by the rendering keyword arguments, the content in the block,
Append to the targets in the dom identified with targets either the content passed in or a
def append_all(targets, content = nil, **rendering, &block) action_all :append, targets, content, **rendering, &block end
def before(target, content = nil, **rendering, &block)
<%= turbo_stream.before "clearance_5" do %>
<%= turbo_stream.before clearance, partial: "clearances/clearance", locals: { title: "Hello" } %>
<%= turbo_stream.before clearance %>
<%= turbo_stream.before "clearance_5", "
the content in the block, or the rendering of the target as a record before the target in the dom. Examples:
Insert the content passed in, a rendering result determined by the rendering keyword arguments,
def before(target, content = nil, **rendering, &block) action :before, target, content, **rendering, &block end
def before_all(targets, content = nil, **rendering, &block)
<%= turbo_stream.before_all ".clearance_item" do %>
<%= turbo_stream.before_all clearance, partial: "clearances/clearance", locals: { title: "Hello" } %>
<%= turbo_stream.before_all clearance %>
<%= turbo_stream.before_all ".clearance_item", "
the content in the block, or the rendering of the target as a record before the targets in the dom. Examples:
Insert the content passed in, a rendering result determined by the rendering keyword arguments,
def before_all(targets, content = nil, **rendering, &block) action_all :before, targets, content, **rendering, &block end
def initialize(view_context)
Experimental RBS support (using type sampling data from the type_fusion
project).
def initialize: (#<Class:0x000000010fb94398> view_context) -> void
This signature was generated using 1 sample from 1 application.
def initialize(view_context) @view_context = view_context @view_context.formats |= [:html] end
def prepend(target, content = nil, **rendering, &block)
<%= turbo_stream.prepend "clearances" do %>
<%= turbo_stream.prepend "clearances", partial: "clearances/unique_clearance", locals: { clearance: clearance } %>
<%= turbo_stream.prepend "clearances", clearance %>
<%= turbo_stream.prepend "clearances", "
or the rendering of the content as a record. Examples:
rendering result determined by the rendering keyword arguments or the content in the block,
Prepend to the target in the dom identified with target either the content passed in or a
def prepend(target, content = nil, **rendering, &block) action :prepend, target, content, **rendering, &block end
def prepend_all(targets, content = nil, **rendering, &block)
<%= turbo_stream.prepend_all ".clearances" do %>
<%= turbo_stream.prepend_all ".clearances", partial: "clearances/new_clearance", locals: { clearance: clearance } %>
<%= turbo_stream.prepend_all ".clearances", clearance %>
<%= turbo_stream.prepend_all ".clearances", "
or the rendering of the content as a record. Examples:
rendering result determined by the rendering keyword arguments or the content in the block,
Prepend to the targets in the dom identified with targets either the content passed in or a
def prepend_all(targets, content = nil, **rendering, &block) action_all :prepend, targets, content, **rendering, &block end
def remove(target)
<%= turbo_stream.remove "clearance_5" %>
do). Examples:
to_key, which is then called and passed through ActionView::RecordIdentifier.dom_id (all Active Records
Removes the target from the dom. The target can either be a dom id string or an object that responds to
def remove(target) action :remove, target, allow_inferred_rendering: false end
def remove_all(targets)
<%= turbo_stream.remove_all ".clearance_item" %>
do). Examples:
to_key, which is then called and passed through ActionView::RecordIdentifier.dom_id (all Active Records
Removes the targets from the dom. The targets can either be a CSS selector string or an object that responds to
def remove_all(targets) action_all :remove, targets, allow_inferred_rendering: false end
def render_record(possible_record)
def render_record(possible_record) if possible_record.respond_to?(:to_partial_path) record = possible_record @view_context.render(partial: record, formats: :html) end end
def render_template(target, content = nil, allow_inferred_rendering: true, **rendering, &block)
def render_template(target, content = nil, allow_inferred_rendering: true, **rendering, &block) case when content.respond_to?(:render_in) content.render_in(@view_context, &block) when content allow_inferred_rendering ? (render_record(content) || content) : content when block_given? @view_context.capture(&block) when rendering.any? @view_context.render(formats: [ :html ], **rendering) else render_record(target) if allow_inferred_rendering end end
def replace(target, content = nil, **rendering, &block)
<%= turbo_stream.replace "clearance_5" do %>
<%= turbo_stream.replace clearance, partial: "clearances/clearance", locals: { title: "Hello" } %>
<%= turbo_stream.replace clearance %>
<%= turbo_stream.replace "clearance_5", "
by the rendering keyword arguments, the content in the block, or the rendering of the target as a record. Examples:
Replace the target in the dom with either the content passed in, a rendering result determined
def replace(target, content = nil, **rendering, &block) action :replace, target, content, **rendering, &block end
def replace_all(targets, content = nil, **rendering, &block)
<%= turbo_stream.replace_all ".clearance_item" do %>
<%= turbo_stream.replace_all clearance, partial: "clearances/clearance", locals: { title: "Hello" } %>
<%= turbo_stream.replace_all clearance %>
<%= turbo_stream.replace_all ".clearance_item", "
by the rendering keyword arguments, the content in the block, or the rendering of the target as a record. Examples:
Replace the targets in the dom with either the content passed in, a rendering result determined
def replace_all(targets, content = nil, **rendering, &block) action_all :replace, targets, content, **rendering, &block end
def update(target, content = nil, **rendering, &block)
Update the content of the dom target identified by clearance_5
<%= turbo_stream.update "clearance_5" do %>
<%= turbo_stream.update clearance, partial: "clearances/unique_clearance", locals: { title: "Hello" } %>
<%= turbo_stream.update clearance %>
<%= turbo_stream.update "clearance_5", "Update the content of the dom target identified by clearance_5" %>
by the rendering keyword arguments, the content in the block, or the rendering of the target as a record. Examples:
Update the target in the dom with either the content passed in or a rendering result determined
def update(target, content = nil, **rendering, &block) action :update, target, content, **rendering, &block end
def update_all(targets, content = nil, **rendering, &block)
Update the content of the dom target identified by the class clearance_item
<%= turbo_stream.update_all "clearance_item" do %>
<%= turbo_stream.update_all clearance, partial: "clearances/new_clearance", locals: { title: "Hello" } %>
<%= turbo_stream.update_all clearance %>
<%= turbo_stream.update_all "clearance_item", "Update the content of the dom target identified by the class clearance_item" %>
by the rendering keyword arguments, the content in the block, or the rendering of the targets as a record. Examples:
Update the targets in the dom with either the content passed in or a rendering result determined
def update_all(targets, content = nil, **rendering, &block) action_all :update, targets, content, **rendering, &block end