0

When I try doing rake db:migrate I get this error

rake aborted! uninitialized constant Rake::DSL
/home/laptop/RubymineProjects/website2/Rakefile:10

What do I have to do to fix this? I tried with multiple different rake versions. I'm running Rails 3.0.9, Ruby 1.8.7 and Ubuntu 11.04.

Michael
  • 644
  • 5
  • 14
  • 33
  • 1
    http://stackoverflow.com/questions/6085610/ruby-on-rails-and-rake-problems-uninitialized-constant-rakedsl – fl00r Aug 11 '11 at 14:33
  • 1
    Which version of Rake are you using? Have a look at this: http://stackoverflow.com/questions/6085610/ruby-on-rails-and-rake-problems-uninitialized-constant-rakedsl – Behrang Aug 11 '11 at 14:53

2 Answers2

6

Include this in your Rakefile

require 'rake/dsl_definition'

Then bundle install and you're (hopefully) good to go :)


If this didn't work, try the following:

You're probably using Rake 0.87 so gem install rake -v=0.9.2 is something you should do.

Then remove old rake with gem uninstall rake -v=0.9.1

Then bundle update

And if you still have any problem then...

Add the following to your Rake file

module ::YourApplicationName  
  class Application
    include Rake::DSL
  end
end

Comment below if you are having any problem after all this little hacks...

dLobatog
  • 1,751
  • 16
  • 17
0

on Debian Squeeze this is what I do to fix that:

Configure squeeze-backports and upgrade rubygems

apt-get install -t squeeze-backports rubygems

remove rake and it's executable

gem uninstall rake
rm /usr/bin/rake

install rake again, now the executable file will be /usr/local/bin/rake and error is gone

gem install rake
Lluís
  • 1,267
  • 1
  • 14
  • 36