0

I'm trying to insert something after a div using broadcast_append_to and i noticed that what I'm inserting it's appended inside the target div.

Ex: index.html.erb:

<%= turbo_stream_from "divs" %>
<div id="append_outside_of_me">
</div>

Broadcast Somewhere: broadcast_append_to "divs", target: "append_outside_of_me", partial: "tests/test"

app.views.tests._test.html.erb:

Appended text

Result:

<div id="append_outside_of_me">
<!-- BEGIN app/views/tests/_test.html.erb -->Appended text<!-- END app/views/tests/_test.html.erb -->
</div>

Wanted result:

<div id="append_outside_of_me">
</div>
<!-- BEGIN app/views/tests/_test.html.erb -->Appended text<!-- END app/views/tests/_test.html.erb -->

How can i append it to the target div but outside of it?

Paul Bob
  • 441
  • 3
  • 10
  • 1
    `broadcast_after_to` https://www.rubydoc.info/gems/turbo-rails/1.3.2/Turbo/Broadcastable#broadcast_after_to-instance_method – Alex Nov 30 '22 at 16:55
  • @Alex, that's it! I must have been tired when searching on docs =')) – Paul Bob Dec 01 '22 at 13:35

0 Answers0