Skip to content

Commit

Permalink
Make .delay method work with ActionMailer::Parameterized::Mailer
Browse files Browse the repository at this point in the history
This PR unifies the DelayedJob behavior of ActionMailer::Base and ActionMailer::Parameterized::Mailer

Now, the following syntax works equivalently:

```ruby
# 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`)
  • Loading branch information
johnnyshields committed Sep 22, 2020
1 parent 5ac5ade commit 7660286
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/delayed_job.rb
Expand Up @@ -16,6 +16,7 @@
ActiveSupport.on_load(:action_mailer) do
require 'delayed/performable_mailer'
ActionMailer::Base.extend(Delayed::DelayMail)
ActionMailer::Parameterized::Mailer.include(Delayed::DelayMail)
end

module Delayed
Expand Down

0 comments on commit 7660286

Please sign in to comment.