mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Use deliver_now in Rails 4.2+, fixes #1933
This commit is contained in:
parent
3dad3f13af
commit
8c5b24a1d5
1 changed files with 13 additions and 1 deletions
|
@ -17,7 +17,19 @@ module Sidekiq
|
||||||
msg = target.public_send(method_name, *args)
|
msg = target.public_send(method_name, *args)
|
||||||
# The email method can return nil, which causes ActionMailer to return
|
# The email method can return nil, which causes ActionMailer to return
|
||||||
# an undeliverable empty message.
|
# an undeliverable empty message.
|
||||||
msg.deliver if msg && (msg.to || msg.cc || msg.bcc) && msg.from
|
deliver(msg) if msg && (msg.to || msg.cc || msg.bcc) && msg.from
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def deliver(msg)
|
||||||
|
if msg.respond_to?(:deliver_now)
|
||||||
|
# Rails 4.2/5.0
|
||||||
|
msg.deliver_now
|
||||||
|
else
|
||||||
|
# Rails 3.2/4.0/4.1
|
||||||
|
msg.deliver
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue