instance method replace

Ruby on Rails 2.0.23

Since v1.3.3 Last seen in v2.0.23

Available in: v1.3.3 v1.4.0 v1.5.0 v2.0.23

Signature

replace(target, content = nil, method: 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 %>
<%= turbo_stream.replace clearance, "<div>Morph the dom target</div>", method: :morph %>

Parameters

target req
content opt = nil
method key = nil
rendering keyrest
block block
Source
# 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

Defined in app/models/turbo/streams/tag_builder.rb line 81 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Turbo::Streams::TagBuilder

Type at least 2 characters to search.

↑↓ navigate · open · esc close