delayed_job in Rails 3

on

I searched for how to use delayed_job and Rails 3 on Google last night and went down a little rabbit hole I thought I could try to help someone else avoid. I ended up at http://www.dixis.com/?p=335 which provided a great, but out of date, article on how to do this. It recommends using collectiveidea’s fork of delayed_job in the master branch, but as it turns out the latest in the master branch in is in flux at the moment. The ActiveRecord backend is currently being abstracted into it’s own gem (which is a great idea) but that means the generators to make the database tables are no longer there. It also in general seems not ready for prime time.

As of today, here’s what you should do for delayed_job and Rails 3:

In your Gemfile:

gem "delayed_job", "~> 2.1.4"

Create the database migration and run it:

$ script/rails generate delayed_job
$ rake db:migrate

Now get out of here and start writing some code!

3 Comments

  1. Sergio Lima

    Hi Jonathan,

    Nice post !

    I was using the following line in my bundle:
    gem “delayed_job”, :git => ‘git://github.com/collectiveidea/delayed_job.git’

    …but it didn’t work: it didn’t generate the migration file, so the “rake db:migrate” command wasn’t working.

    I used the following line in my bundle and after “bundle install” the migration file was created:
    gem “delayed_job”, “~> 2.1.4″

    Thanks a lot .

    Regards,
    Sergio Lima

  2. burntkraut

    Thanks for saving me the visit to the Mad Hatter. ;)

    Hope all is well,
    Bernd

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>