ruby-on-rails – 使用delayed_job的NotImplementedError(使用排
在我的Rails应用程序(4.2.4)中,我一直在尝试将异步邮件发送到工作中.
我安装了delayed_job作为我的队列适配器,并在几个地方将其设置为适配器:config / application.rb,config / environments / {development,production} .rb和config / initializers / active_job.rb. 安装: 我把它添加到我的Gemfile中: gem 'delayed_job_active_record' 然后,我运行了以下命令: $bundle install $rails generate delayed_job:active_record $rake db:migrate $bin/delayed_job start 在config / application.rb中,config / environments / production.rb,config / environments / development.rb: config.active_job.queue_adapter = :delayed_job 在config / initializers / active_job.rb中(当上面的内容不起作用时添加): ActiveJob::Base.queue_adapter = :delayed_job 我还为delayed_job运行了一个ActiveRecord迁移,并在运行我的服务器之前启动了bin / delayed_job. 话虽如此,任何时候我尝试: UserMailer.welcome_email(@user).deliver_later(wait: 1.minutes) 我收到以下错误: NotImplementedError (Use a queueing backend to enqueue jobs in the future. Read more at http://guides.rubyonrails.org/active_job_basics.html): app/controllers/user_controller.rb:25:in `create' config.ru:25:in `call' 我的印象是delayed_job是一个排队的后端…我错过了什么? 编辑: 我也无法让sucker_punch工作.在捆绑器中安装sucker_punch时,使用: config.active_job.queue_adapter = :sucker_punch 在config / application.rb中,我得到了相同的错误和堆栈跟踪. 解决方法
提供你遵循
here列出的所有步骤,我觉得你没有启动delayed_job运行
bin/delayed_job start 还请检查你的运行情况 rails generate delayed_job:active_record rake db:migrate (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |