I used it like this: controller
flash.now[:error] = "some errors" render turbo_stream: turbo_stream.replace("flash_alert", partial: "layouts/flash", locals: { flash: flash })
view
<%= turbo_frame_tag "flash" do %> <%= render "layouts/flash" %> <% end %>
layouts/_flash.html.erb:
<div id="flash_alert"> <% flash.each do |type, message| %> <%= message %> <% end %> </div>
why would you want to use turbo_stream.replace rather than turbo_stream.update?
turbo_stream.replace
turbo_stream.update
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I used it like this:
controller
view
layouts/_flash.html.erb:
why would you want to use
turbo_stream.replace
rather thanturbo_stream.update
?