class TagBuilder
Ruby on Rails 1.5.0
Since v1.3.3 Last seen in v2.0.23This tag builder is used both for inline controller turbo actions (see Turbo::Streams::TurboStreamsTagBuilder) and for turbo stream templates. This object plays together with any normal Ruby you’d run in an ERB template, so you can iterate, like:
<% # app/views/postings/destroy.turbo_stream.erb %> <% @postings.each do |posting| %> <%= turbo_stream.remove posting %> <% end %>
Or string several separate updates together:
<% # app/views/entries/_entry.turbo_stream.erb %>
<%= turbo_stream.remove entry %>
<%= turbo_stream.append "entries" do %>
<% # format is automatically switched, such that _entry.html.erb partial is rendered, not _entry.turbo_stream.erb %>
<%= render partial: "entries/entry", locals: { entry: entry } %>
<% end %>
Or you can render the HTML that should be part of the update inline:
<% # app/views/topics/merges/_merge.turbo_stream.erb %> <%= turbo_stream.append dom_id(topic_merge) do %> <%= link_to topic_merge.topic.name, topic_path(topic_merge.topic) %> <% end %>
Inherits from
Includes
Methods (defined here)
- # action
- # action_all
- # after
- # after_all
- # append
- # append_all
- # before
- # before_all
- # prepend
- # prepend_all
- # remove
- # remove_all
- # replace
- # replace_all
- # update
- # update_all
- self. new