I have installed Rails 5.0.0.rc1 as well as the DelayedJob gem. I have some code that worked perfectly fine in previous Rails apps (Rails4.2), but for some reason it keeps on failing in production on heroku now.
In short, I'm trying to send an email using DelayedJob's 'handle_asynchronously' method. I have created the mailer and added the callback in my model, but when I submit the form on Heroku, I am presented with a Rails error screen. In my logs, I am seeing an error stating 'ArgumentError: wrong number of arguments (given 1, expected 0)'. If I remove the 'handle_asynchronously' methods then my callbacks work. I obviously want to send mails etc. using DelayedJob however.
My code looks like this:
FooModel.rb
....
after_create :send_welcome_mail
def send_welcome_mail
FooMailer.welcome_email(self).deliver
end
handle_asynchronously :send_welcome_mail
Like I stated, this code worked flawlessly with Rails4. Could anybody help me? Do I need to do something differently in Rails5?
It looks to me like Delayed Job does not support Rails 5 yet:
https://github.com/collectiveidea/delayed_job/issues/896
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With