Error in rake db:migrate: rake aborted! uninitialized constant Rake::DSL

2012.01.14 | Ruby | , ,

I’ve never had this issue before, but I recently started using rvm and for whatever reason got the following error when trying to do rake db:migrate

rake aborted!
uninitialized constant Rake::DSL
/usr/local/Cellar/ruby/1.9.2-p290/lib/ruby/1.9.1/rake.rb:2482:in `const_missing’

After googling around and trying a bunch of convoluted solutions (many which addressed a broken 0.9.0 build of rake), I found that adding the following line to my Rakefile fixed everything:

require ‘rake/dsl_definition’