Method: Turbo::Streams::TagBuilder#update

Defined in:
app/models/turbo/streams/tag_builder.rb

#update(target, content = nil, method: nil, **rendering, &block) ⇒ Object

Update the target in the dom with either the content passed in or a rendering result determined by the rendering keyword arguments, the content in the block, or the rendering of the target as a record. Examples:

<%= turbo_stream.update "clearance_5", "Update the content of the dom target identified by clearance_5" %>
<%= turbo_stream.update clearance %>
<%= turbo_stream.update clearance, partial: "clearances/unique_clearance", locals: { title: "Hello" } %>
<%= turbo_stream.update "clearance_5" do %>
  Update the content of the dom target identified by clearance_5
<% end %>
<%= turbo_stream.update clearance, "<div>Morph the dom target</div>", method: :morph %>


161
162
163
# File 'app/models/turbo/streams/tag_builder.rb', line 161

def update(target, content = nil, method: nil, **rendering, &block)
  action :update, target, content, method: method, **rendering, &block
end