I add a job to delayed job but when I run it I have a NoMethod error
Delayed::Job.last => #Delayed::Backend::MongoMapper::Job _id: BSON::ObjectId('5266f28aa1cba6257b000001'), attempts: 0, created_at: Tue, 22 Oct 2013 23:47:54 CEST +02:00, failed_at: nil, handler: "--- !ruby/struct:Delayed::PerformableMethod \nobject: !ruby/object:Module {}\n\nmethod: :notify_all_with_review_reminder_due!\nargs: []\n\n", last_error: nil, locked_at: nil, locked_by: nil, priority: 75, run_at: Tue, 22 Oct 2013 23:47:54 CEST +02:00, updated_at: Tue, 22 Oct 2013 23:47:54 CEST +02:00>
Delayed::Job.last.invoke_job NoMethodError: undefined method `notify_all_with_review_reminder_due!' for #Module:0x124781cf0>
Looks like he is not able to serialize the correct object (it is a module). Googling around I found the suggestion to require the module in config/inizializers but this is not working for me.
Any idea?
I had hit similar problem, and at time of writing this I have not found any other solution besides the "require" but in my case I was trying to queue the module class, so I just wrapped it with class and it wroks now. before:
module GlobalModule
def self.some_method
end
end
Delayed::Job failing with similar error when calling GlobalModule::delay.some_method
after:
module GlobalModule
class Wrapper
def self.some_method
end
end
end
GlobalModule::Wrapper.delay.some_method