So I've figured out how to broadcast/render to two different model views, but I'm trying to broadcast/render a different partial/design for the view.
Whenever Hotwire broadcast/renders an object, it looks for the original partial, in my case questions/question through id="questions".
When broadcasting a new object to a view, the object gets broadcasted from questions/question and only renders the desired partial questions/question_live once the page has been refreshed, or if the questions/question_live is already on the page.
Do you know if there is a way to stop Hotwire from rendering the id="questions" from partial questions/question and render from questions/question_live?
Is Hotwire able to broadcast to two different model views? I'm having some trouble with that :/
Yeah it can! Post your code up :)
So I've figured out how to broadcast/render to two different model views, but I'm trying to broadcast/render a different partial/design for the view.
Whenever Hotwire broadcast/renders an object, it looks for the original partial, in my case
questions/question
throughid="questions"
.When broadcasting a new object to a view, the object gets broadcasted from
questions/question
and only renders the desired partialquestions/question_live
once the page has been refreshed, or if thequestions/question_live
is already on the page.Example code
<tbody id="questions">
<%= render collection: @questions, partial: "questions/question_live", as: :question %>
</tbody>
Do you know if there is a way to stop Hotwire from rendering the
id="questions"
from partialquestions/question
and render fromquestions/question_live
?Figured it out.
Question model
live_room show view
<%= turbo_stream_from :live_rooms %>
...
code...
...
room show view
<%= turbo_stream_from :rooms %>
...
code...
...