Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delayed_job : NoMethodError: undefined method `my_method_without_delay'

Using rails 2.3.11 and delayed_job 2.0.4 as a gem I get an error when using handle_asynchronously :

In my ActionMailer model, I delcared my_method and added ' handle_asynchronously :my_method' right after the declaration :

class MailSender < ActionMailer::Base
    def my_method
        ...
    end
    handle_asynchronously :my_method
end

When calling MailSender.deliver_my_method the task is correctly added to the queue. But when trying to process it, it fails with the error message :

undefined method `rappel_email_without_delay' for #<YAML::Object:0x1034b85f8>

Delaying with MailSender.delay.deliver_my_method is working and the task correctly processed - But i'd rather use handle_asynchronously un my model to ensure mail are always sent in the background...

like image 813
LapinLove404 Avatar asked Dec 22 '22 10:12

LapinLove404


1 Answers

You need to restart the worker processes using

rake jobs:work

like image 54
serengeti12 Avatar answered Apr 27 '23 23:04

serengeti12