How do I configure ActiveJob to use Resque?

luis.madrigal

I am having a bit of difficulty with ActiveJob in Rails 4.2 and Resque.

I've installed redis and I've added resque and resque-scheduler to my Gemfile.

I've created a test job - it is just the generated file

rails g job test

but I keep getting errors about ActiveJob not defined

NameError: uninitialized constant ActiveJob

or missing method when I switch the adapter like this

config.active_job.queue_adapter = :resque

I get this error

/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta1/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `active_job' for #<Rails::Application::Configuration:0x007f97ba98a5b8> (NoMethodError)

I've even looked at the source code but I have no idea. It is just calling super.

https://github.com/rails/rails/blob/master/railties/lib/rails/railtie/configuration.rb#L95

What I am missing? Why doesn't the queue adapter work? Does anyone know how to fix this?

luis.madrigal

I turns out that I had selected which frameworks I was using.

# config/application.rb 
require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"

The way to fix it, is to add the Active Job framework in the application.rb file.

require "active_job/railtie"

Or to load all of Rails

require 'rails/all'

This seems to be working now.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How do I configure Docker to use ZFS?

분류에서Dev

How do I use puppet to configure network settings?

분류에서Dev

How do I configure irssi?

분류에서Dev

How do I configure environment variables in cmder?

분류에서Dev

Resque ActiveJob 큐를 삭제하는 방법

분류에서Dev

How do I use MapStateListener?

분류에서Dev

How do i configure samba on my Ubuntu Server 14.04

분류에서Dev

How do I use OR with if statements in regards to strings

분류에서Dev

How do i use Blazor components in the code?

분류에서Dev

Python: How do i use itertools?

분류에서Dev

How do I use runit with zookeeper

분류에서Dev

How do I use Firefox cookies with Wget?

분류에서Dev

How do I use the GeometryConstraint class?

분류에서Dev

How do I make use of rotation matrices?

분류에서Dev

How do i use SetPixel on a new Bitmap?

분류에서Dev

How do i get cURL to use https

분류에서Dev

How do I use "<<" with my own struct?

분류에서Dev

How do I use URL directories as variables?

분류에서Dev

What is fileAPI ? How do I use it with angular?

분류에서Dev

How do I open and use phpmyadmin?

분류에서Dev

How do I use the latest GCC on Ubuntu?

분류에서Dev

How do I use man pages to learn how to use commands?

분류에서Dev

How to configure Django to Use mysql

분류에서Dev

How to bypass Resque in a development environment

분류에서Dev

How do I install and use PyCharm without having to use a terminal?

분류에서Dev

How do I install and use PyCharm without having to use a terminal?

분류에서Dev

In Android Studio how can I configure my project to use Java 8

분류에서Dev

Getting a package not found when I do ./configure

분류에서Dev

How do I configure APN settings on my QMI-based 4G modem?