0

执行 SampleController 时出现以下错误。

uninitialized constant IdeasController::Delayed

我已经使用 rake jobs:work 启动了delayed_job。我在 SampleController.rb 中有以下延迟作业代码

Delayed::Job.enqueue(DelayedWorker.new({:model=>object.class.to_s,:object_id=>object.id,:meth=>:create_suggestion}))

delay_worker.rb 包含以下代码:

class DelayedWorker < Struct.new(:options)

  def perform

    if obj=Object.const_get(options[:model]).find(options[:object_id])

      if (options[:para] ? obj.send(options[:meth],options[:para].first) : obj.send(options[:meth]))
        puts "Successfull"
      else
        puts "Failed"
      end
    end
  end
end

任何人请帮我解决这个问题。

谢谢...

4

1 回答 1

0

改变

Delayed::Job.enqueue(DelayedWorker.new({:model=>object.class.to_s,:object_id=>object.id,:meth=>:create_suggestion}))

::Delayed::Job.enqueue(DelayedWorker.new({:model=>object.class.to_s,:object_id=>object.id,:meth=>:create_suggestion}))
于 2013-07-20T12:08:47.853 回答