I’ve got this ruby on rails project and I want to do db:migrate. But the only rake option I got is “Reload rake tasks” so when I hit that, it gives me this error.
[rake --tasks] rake aborted!
uninitialized constant Rake::DSL
/usr/lib/ruby/1.8/rake.rb:2503:in `const_missing'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/tasklib.rb:8
/var/lib/gems/1.8/gems/rdoc-3.9.1/lib/rdoc/task.rb:37:in `require'
/var/lib/gems/1.8/gems/rdoc-3.9.1/lib/rdoc/task.rb:37
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/tasks/documentation.rake:2:in `require'
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/tasks/documentation.rake:2
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/tasks.rb:15:in `load'
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/tasks.rb:15
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/tasks.rb:6:in `each'
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/tasks.rb:6
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:215:in `require'
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:215:in `initialize_tasks'
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:139:in `load_tasks'
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:77:in `send'
/var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
/home/laptop/RubymineProjects/auth/Rakefile:7
/usr/lib/ruby/1.8/rake.rb:2383:in `load'
/usr/lib/ruby/1.8/rake.rb:2383:in `raw_load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2017:in `load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:2016:in `load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2000:in `run'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:28
Thanks, Michael.
This is a common problem. Just follow these steps:
gem install rake -v=0.9.2(If you have the 0.9.1 gem)gem uninstall rake -v=0.9.1(If you have the 0.9.1 gem)Looking at your logs, I see you have
rake-0.9.2so I think you can skip the 2 steps above.bundle updateThen, running
db:migratewill give you an error like this:WARNING: Global access to Rake DSL methods is deprecatedTo solve, this you just have to add these two lines to the top of your
Rakefilerequire 'rake/dsl_definition'include Rake::DSLIt should work perfectly fine after that!