Skip to content

Commit 37530c0

Browse files
stufroseanpdoyle
authored andcommitted
Fix update_all documentation to use class selector syntax
The examples showed a bare class name ("clearance_item") as the targets argument, but Turbo requires a CSS selector (".clearance_item") to match multiple elements by class. The bare form silently fails to match anything in the browser. Fixes #711
1 parent 435135b commit 37530c0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/models/turbo/streams/tag_builder.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ def update(target, content = nil, method: nil, **rendering, &block)
165165
# Update the <tt>targets</tt> in the dom with either the <tt>content</tt> passed in or a rendering result determined
166166
# by the <tt>rendering</tt> keyword arguments, the content in the block, or the rendering of the targets as a record. Examples:
167167
#
168-
# <%= turbo_stream.update_all "clearance_item", "Update the content of the dom target identified by the class clearance_item" %>
168+
# <%= turbo_stream.update_all ".clearance_item", "Update the content of the dom targets identified by the class clearance_item" %>
169169
# <%= turbo_stream.update_all clearance %>
170170
# <%= turbo_stream.update_all clearance, partial: "clearances/new_clearance", locals: { title: "Hello" } %>
171-
# <%= turbo_stream.update_all "clearance_item" do %>
172-
# Update the content of the dom target identified by the class clearance_item
171+
# <%= turbo_stream.update_all ".clearance_item" do %>
172+
# Update the content of the dom targets identified by the class clearance_item
173173
# <% end %>
174174
# <%= turbo_stream.update_all clearance, "<div>Morph the dom target</div>", method: :morph %>
175175
def update_all(targets, content = nil, method: nil, **rendering, &block)

0 commit comments

Comments
 (0)