2020/09/04
I built a Rails mailer for the first time in a very long time today. Revisiting the docs, I was greeted with a signature I didn’t recall from the past.
Mailer.with(some: "params", set: "this way").email_name.deliver_later
In the past, I’d always invoked mailers with
Mailer.email_name(some: "params", set: "this way").deliver_later
The with message feels very aligned with ActiveJob.set. For things that are needed on all mailers, like the recipient, I like standardizing on this approach for communicating params into the mailer.