Activity
Posted in How to use Hotwire in Rails Discussion
Thanks for the vid, Chris!
Didn't actually get one thing. For some reason, I can't afford broadcasting with a model callback (like it's shown in the lesson), and I therefore need to broadcast from the controller action.
I checked the docs, and here's how I made it:
...
if @tweet.save
format.turbo_stream do
render turbo_stream: turbo_stream.prepend(:tweets, partial: "tweets/tweet",
locals: { tweet: @tweet })
end
format.html { redirect_to tweets_url, notice: 'Tweet was successfully created.' }
format.json { render :show, status: :created, location: @tweet }
else
...
This approach works pretty much like the original from the lesson, but! The new tweets don't appear in another browser tab! New tweet does show up on the author's tab, but on any other tab/browser/device -- it simply doesn't.
Frankly, I didn't really spend much time digging in the docs, did I miss anything maybe?
Best.
Posted in Anyone with experience using Quilljs?
Just in case anybody's from 2020.
Take a look here https://www.kohrvid.com/blog/posts/using-quilljs-with-rails-6