uninitialized constant Delayed::Job

Ger picture Ger · Jul 10, 2011 · Viewed 12.4k times · Source

I've added the delayed_job gem to my gemfile and installed correctly but when I try to run the following line:

Delayed::Job.enqueue do_it(), 0, 1.minutes.from_now.getutc

I get the error 'uninitialized constant Delayed::Job'

Can somebody explain what i need to do here? I've tried running 'rake jobs:work' beforehand but it also returns the 'uninitialized constant Delayed::Job' error. Additionally, I've added "require 'delayed_job'" to the file (application.rb) without much luck.

Answer

Zubin picture Zubin · Jan 15, 2012

If you've upgraded to delayed_job version >=3 you'll need to add this (presuming you're using ActiveRecord):

# Gemfile
gem 'delayed_job_active_record'