In a manner of speaking I assume that the turbo_stream_from subscribes to the Posts ApplicationRecord's broadcast_to?
Close! Theturbo_stream_from :posts tells the users Browser to subscribe to :posts stream (It just adds a snippet of HTML to the page) & in the Post model we're telling it to broadcast to the:posts stream.
Additionally is @posts available to the view because of the broadcast,
I didn't post up the code controller action where I set that, I'll aim to do a more in depth write up in the future. The broadcast method passes the current model to app/views/posts/_post.html.erb as the post value.
In a manner of speaking I assume that the
turbo_stream_from
subscribes to the PostsApplicationRecord
'sbroadcast_to
?Additionally is
@posts
available to the view because of the broadcast, or are you just not showing your method implementations?Close! The
turbo_stream_from :posts
tells the users Browser to subscribe to:posts
stream (It just adds a snippet of HTML to the page) & in thePost
model we're telling it to broadcast to the:posts
stream.I didn't post up the code controller action where I set that, I'll aim to do a more in depth write up in the future. The broadcast method passes the current model to
app/views/posts/_post.html.erb
as thepost
value.Thanks! That clarifies things a lot!
Ill keep my fingers crossed and an eye out for your detailed write up!