Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

delayed_job doesn't work (rails 3.1.3)

Trying to use gem delayed_job from collectiveidea(https://github.com/collectiveidea/delayed_job) in my project, but it throws exception: "uninitialized constant Delayed::DelayProxy::Job".

What I've done to install it: Gemfile:

gem 'daemons'
gem 'delayed_job'
gem 'delayed_job_active_record'

Command line:

bundle install
rails generate delayed_job:active_record
rake db:migrate
rake jobs:work

Using it in controller:

Video.delay.convert

I've done all of this like in instruction, but it doesn't work. Googled much, but can't find helpful instruction. I've found railscasts sources with delay_work, but all code(Gemfile, script, controllers, models) is the same as mine, but RC's code works, mine - no.

P.S.: I'm new to ruby and rails, may be my question is lame, but I'm trying to solve this problem second day. And... sorry for my bad english :)

like image 289
Alexey Krasnoperov Avatar asked Jan 19 '12 19:01

Alexey Krasnoperov


2 Answers

From the comment above:

All I needed to do is to write to initializer(initializers/delayed_job_config.rb): Delayed::Worker.backend = :active_record And restart the web-server. It doesn't apply without restart even in develop environment.

like image 170
Alexey Krasnoperov Avatar answered Oct 19 '22 16:10

Alexey Krasnoperov


Try this:

gem 'delayed_job_active_record', :git => 'git://github.com/collectiveidea/delayed_job_active_record.git'
like image 1
msroot Avatar answered Oct 19 '22 14:10

msroot