我有一个非常令人沮丧的问题:Rake愚蠢。
问题出在这里:
$ rails new test_app
$ rails generate scaffold new_scaffold field1:string field2:text
两者都很好,但是当我这样做时,
$ rake db:migrate
我收到以下错误。
(in /home/mikhail/test_app)
rake aborted!
uninitialized constant Rake::DSL
/usr/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/tasklib.rb:6:in `<module:Rake>'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/tasklib.rb:3:in `<top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/rdoctask.rb:20:in `require'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/rdoctask.rb:20:in `<top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks/documentation.rake:1:in `require'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks/documentation.rake:1:in `<top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `load'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `block in <top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:6:in `each'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:6:in `<top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:214:in `require'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:214:in `initialize_tasks'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:139:in `load_tasks'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
/home/mikhail/test_app/Rakefile:7:in `<top (required)>'
/usr/lib/ruby/1.9.1/rake.rb:2373:in `load'
/usr/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/usr/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/lib/ruby/1.9.1/rake.rb:1991:in `run'
/usr/bin/rake:31:in `<main>'
我曾经在Internet上查找过类似/相同的错误,而且人们也曾遇到过。似乎没有人能解决问题!
我该如何解决这个问题?
bundle update rake
。然后我检查了bundle show rake
。应该说0.8.7。然后rake db:migrate
。