Heroku ‘uninitialized constant Rake::DSL’

I ran into this problem while learning how to work with Heroku. (Heroku had some pretty big news for themselves this week, announcing Yukihiro Matsumoto had joined them as “Chief Architect, Ruby”).

The problems happens after you’ve pushed your app up, when you’re trying to run your rake db:migrate.

So I found the solution in one of the posts over here: at stackoverflow, … so if this doesn’t work for you, try one of the other answers (shrug).

Basically, I had to use an older version of rake. So in my Gemfile, I added:

# Hack to workaround Heroku 'uninitialized constant Rake::DSL'
gem "rake", "0.8.7"

Then a few commands to get ourselves up to date:

$ bundle update rake
$ git commit -a -m "Use 0.8.7 of rake"

And then of course re-run our db:migrate:

$ heroku rake db:migrate