Method: Turbo::Streams::TagBuilder#replace
- Defined in:
- app/models/turbo/streams/tag_builder.rb
#replace(target, content = nil, method: nil, **rendering, &block) ⇒ Object
Replace the target in the dom with either the content passed in, 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.replace "clearance_5", "<div id='clearance_5'>Replace the dom target identified by clearance_5</div>" %>
<%= turbo_stream.replace clearance %>
<%= turbo_stream.replace clearance, partial: "clearances/clearance", locals: { title: "Hello" } %>
<%= turbo_stream.replace "clearance_5" do %>
<div id='clearance_5'>Replace the dom target identified by clearance_5</div>
<% end %>
<%= turbo_stream.replace clearance, "<div>Morph the dom target</div>", method: :morph %>
81 82 83 |
# File 'app/models/turbo/streams/tag_builder.rb', line 81 def replace(target, content = nil, method: nil, **rendering, &block) action :replace, target, content, method: method, **rendering, &block end |