活动的工作错误

时间:2016-03-17 08:37:44

标签: ruby-on-rails ruby ruby-on-rails-4 rails-activejob

我尝试使用Rails 4.2.6在后台运行一些工作,我收到了这个错误:

uninitialized constant Delayed::Job    
app/controllers/pipls_controller.rb:9:in `research'    

以下是代码:

app/jobs/miner.rb

class Miner < ActiveJob::Base
  queue_as :default

  def perform(params)
    ...
  end
end

app/controllers/pipls_controller.rb

class PiplsController < ApplicationController
  def research
    Miner.perform_later(params)
    redirect_to pipls_path
  end
end

config/application.rb

module Db
  class Application < Rails::Application
    config.active_record.raise_in_transactional_callbacks = true
    config.active_job.queue_adapter = :delayed_job
  end
end

Gemfile

gem 'delayed_job'

Sidekiq和Resque也不起作用。

我做错了什么?

0 个答案:

没有答案