开发者

Delayed::Job with modules

开发者 https://www.devze.com 2023-01-31 14:21 出处:网络
Does Delayed::Job work with modules? I have trouble with it: module SomeModule class SomeClass def regular_method

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

0

精彩评论

暂无评论...
验证码 换一张
取 消