我有这样的课
class RecurringJob
include ScheduledJob
run_every 1.hours
def perform
puts "perform job"
end
end
我收到一条错误消息:
预期 D:/ASM/source/app/lib/jobs/scheduled_job.rb 来定义 ScheduledJob
文件定义是这样的:
module Delayed
module ScheduledJob
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
@@logger = Delayed::Worker.logger
cattr_reader :logger
end
end
....
end
end
错误是什么意思?这不是一个定义吗?
编辑
我你必须知道,这个类是在一个 rake 任务中定义的(除了这个类之外它是空的,我不知道这是否允许)。
更详细的错误:
Expected D:/ASM/source/app/lib/jobs/scheduled_job.rb to define ScheduledJob
D:/Software/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:503:in `load_missing_constant'
D:/Software/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:192:in `block in const_missing'
D:/Software/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `each'
D:/Software/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `const_missing'
D:/Software/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:514:in `load_missing_constant'
D:/Software/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:192:in `block in const_missing'
D:/Software/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `each'
D:/Software/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `const_missing'
D:/ASM/source/app/lib/tasks/sandbox.rake:29:in `<class:RecurringJob>'
D:/ASM/source/app/lib/tasks/sandbox.rake:28:in `block in <top (required)>'