instance method
replace
Ruby on Rails 1.4.0
Since v1.3.3 Last seen in v2.0.23Signature
replace(target, content = nil, **rendering, &block)
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 %>
Parameters
-
targetreq -
contentopt = nil -
renderingkeyrest -
blockblock
Source
# File app/models/turbo/streams/tag_builder.rb, line 62
def replace(target, content = nil, **rendering, &block)
action :replace, target, content, **rendering, &block
end
Defined in app/models/turbo/streams/tag_builder.rb line 62
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Turbo::Streams::TagBuilder