0

I've updated a couple of gems and what not, namely upgraded rails to version 3.0.7

The project has quite a few delayed_jobs in it, however now when I come to start the jobs in the terminal with the command:

rake jobs:work

I get an error message saying:

undefined method `task' for #<MyAppName::Application:0x10350ab78>

The rake file current has the follwing in it, in realation to delayed jobs I think:

MyAppName::Application.load_tasks

I was wondering if anyone new how to fix this problem and get delayed jobs running again.

Also as far as I can tell there is no problem with adding the jobs to the db, the problem is purly with starting the tasks on my local machen via the terminal.

Thanks!

CafeHey
  • 5,699
  • 19
  • 82
  • 145

3 Answers3

2

This fix worked for me

Undefined method 'task' using Rake 0.9.0

Community
  • 1
  • 1
Addsy
  • 3,944
  • 2
  • 32
  • 35
1

Did you upgrade rake? Apparently Rake 0.9 broke Rails 3.0.7:

Rake 0.9, which was released yesterday, broke Rails (and others). While we wait for a fix, you'll want gem 'rake', '0.8.7' in your Gemfile. - David Heinemeier Hansson

Kevin Sylvestre
  • 37,288
  • 33
  • 152
  • 232
  • Cheers, I tried that but then I get the error message: 'You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7. Consider using bundle exec.' When running rake jobs:work – CafeHey May 21 '11 at 16:51
  • @Smickie Try deleting your Gemfile.lock and then run `bundle install`. After that, be sure to restart your web server and take a look into your Gemfile.lock to ensure the right version of rake is being used. – Kevin Sylvestre May 21 '11 at 16:59
  • @Smickie, you need to either uninstall 0.9.0, or use `bundle exec rake ...`. See http://stackoverflow.com/questions/5287121/undefined-method-task-using-rake-0-9-0-beta-4 – Andrei May 21 '11 at 21:11
0

Have you tried updating to the latest delayed_job plugin? run bundle install? what happens if you run rails script/delayed_job start?

Gal
  • 23,122
  • 32
  • 97
  • 118