I'm trying to add a toast after running a background job, i.e., the type and content of the toast depends on wether or not a certain service object called in the BG job is successful or not.
I can render the toasts correctly when I stream from a turbo_stream controller format response, but if I try to stream from the Job with
Turbo::StreamsChannel.broadcast_append_to 'toasts' ... it doesn't have any error and in the logs I can see the partial was rendered but it never gets delivered to the UI.
Any ideas on how to do this?
Posted in In-App Navbar Notifications Discussion
- "John D started following you"
- "Jane D sent you a friend request"
I did a quick test and added a `notification_to_s` method to my `Follow` and `FriendRequest` models like so:
# follow.rb def notification_to_s "following you" end
# friend_request.rb def notification_to_s "you a friend request" end
And then adapted the jbuilder method like this:
# index.json.jbuilder # ... json.notifiable do json.type notification.notifiable.notification_to_s end
This doesn't seem as dynamic as your example. Can you think of a better way to do this?
Any ideas on how to go about this without Jquery and/or jQuery file upload?
I was able to fixe Rails.ajax by updating my gemfile to run Rails 5.1 or above and by requiring rails-ujs in application.js
Hi Chris. First of all, thanks for putting this out, GoRails has been a great resource to implement new features and learn.
I've got a file in my model that gets upload with Shrine to S3 (works perfectly) and I was wondering how can I attach that file when sending email with a Mailer?