I have followed the getting started with active job article by EngineYard. The article states:
You'll need Rails 4.2.0beta1 or greater if you want to Active Job available by default (in older versions of Rails, you can require it as a gem)
I am trying to use ActiveJob in my Rails 4.1 project. I added ActiveJob to my gemfile gem 'activejob'
. As per the article, I have:
#config/initializers/active_job.rb
ActiveJob::Base.queue_adapter = :resque
However, when I run rails server
I get the following error:
config/initializers/active_job.rb:1:in
': uninitialized constant ActiveJob (NameError)`
EDIT - Fixed typo "gem active job"
UPDATE 1
Following solydest's suggestion below, adding require 'active_job'
to application.rb allows me to no longer get the uninitialized constant ActiveJob
error but instead I receive the error undefined method perform_later'
when I try to call my job. I am following the edge rails guide and enqueue my job with code similar to:
MyJob.perform_later(record)
The beginning of my job class:
class MyJob < ActiveJob::Base
queue_as :images
def perform(id)
I added require 'active_job'
to config/application.rb just below all the other require directives and that solved the issue for me.