You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classClearance < ApplicationRecordbelongs_to:petitioner,class_name: "Contact"belongs_to:examiner,class_name: "User"after_create_commit:broadcast_laterprivate# Sends <turbo-stream action="replace" target="clearance_5"><template><div id="clearance_5">Other partial</div></template></turbo-stream># to the stream named "identity:2:clearances"defbroadcast_laterbroadcast_replace_later_toexaminer.identity,:clearances,target: self,partial: "clearances/other_partial",locals: {clearance: self}endend
We are scheduling a job to render the template and broadcast it later.
Overall it’s pretty similar to the way we send emails, right?
However for the emails we have an ActionMailer which acts as a controller layer and initialises the objects before passing to views.
Here we don’t have any intermittent layer, so the background job just loads the objects from database and passes them directly to views, leaving us without an option to modify or set up the objects before rendering, e.g. apply a decorator.
So I’m wondering if there were already any thoughts on implementing something like a Broadcaster layer, similar to Mailer?
The text was updated successfully, but these errors were encountered:
@dhh thanks for the reference :)
Sure, we can always customize the job.
I was just wondering if there any thoughts on more structured approach, given it’s very early days of Hotwire itself and the rails integration in particular.
Take this example:
We are scheduling a job to render the template and broadcast it later.
Overall it’s pretty similar to the way we send emails, right?
However for the emails we have an
ActionMailer
which acts as a controller layer and initialises the objects before passing to views.Here we don’t have any intermittent layer, so the background job just loads the objects from database and passes them directly to views, leaving us without an option to modify or set up the objects before rendering, e.g. apply a decorator.
So I’m wondering if there were already any thoughts on implementing something like a Broadcaster layer, similar to Mailer?
The text was updated successfully, but these errors were encountered: