Delayed::Job with modules
Does Delayed::Job work with modules? I have trouble with it:
module SomeModule
class SomeClass
def regular_method
self.delay.long_method "test"
end
def long_method data
puts data
end
end
end
Error message:
[Worker(host:leo pid:10480)] SomeModule::SomeClass#long_method failed with NoMethodError: undefined method `long_method' for #<YAML::Object:0xcee13b0 @class="SomeModule::SomeClas开发者_运维技巧s", @ivars={}> - 4 failed attempts
[Worker(host:leo pid:10480)] 1 jobs processed at 9.1484 j/s, 1 failed ...
This problem in rails class auto loading. Just add
require "#{Rails.root}/app/models/some_module/some_class"
to initializers or environment.rb
精彩评论