collectiveidea / delayed_job

Database based asynchronous priority queue system -- Extracted from Shopify
http://groups.google.com/group/delayed_job
MIT License
4.81k stars 955 forks source link

Make .delay method work with ActionMailer::Parameterized::Mailer #1121

Closed johnnyshields closed 3 years ago

johnnyshields commented 3 years ago

Rails 5.1 introduced parameterized mailers

This PR unifies the DelayedJob behavior of ActionMailer::Base and ActionMailer::Parameterized::Mailer

Now, the following syntax works equivalently:

# works currently
MyMailer.delay.my_method

# this PR makes the following work
MyMailer.with(foo: 1, bar: 2).delay.my_method

Note that ActionMailer::Parameterized::Mailer does not inherit ActionMailer::Base (moreover, the .with() method returns an object instance, hence we use include rather than extend)

johnnyshields commented 3 years ago

Sweet! Thanks