0
votes

I am going through a tutorial and have an issue with rake db:migrate and my gemfile. I KNOW there are several answers, and this question is asked (and answered a lot) here. But for some reason, I am either running in circles, confused or maybe something else is going on that I'm not aware of.

I've tried the answer referenced here -- where I ran

bundle exec run rake -T

That did not seem to work.

Then I tried to follow dhh's advice referenced here, but my system is saying that I don't have the gemfile to uninstall. Here is what I did:

Z-Kidds-MacBook-Air:demo_app zkidd$ rake --version
rake, version 0.9.2.2
Z-Kidds-MacBook-Air:demo_app zkidd$ gem uninstall rake -v=0.9.2.2
INFO:  gem "rake" is not installed
Z-Kidds-MacBook-Air:demo_app zkidd$ 

Anyways, here is the read-out when I run trace:

Z-Kidds-MacBook-Air:demo_app zkidd$ rake db:migrate --trace rake aborted! You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.8.7. Using bundle exec may solve this. /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in block in setup' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:17:insetup' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler.rb:110:in setup' /Users/zkidd/rails_projects/demo_app/config/boot.rb:8:in' /Users/zkidd/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' /Users/zkidd/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' /Users/zkidd/rails_projects/demo_app/config/application.rb:1:in <top (required)>' /Users/zkidd/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' /Users/zkidd/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' /Users/zkidd/rails_projects/demo_app/Rakefile:4:in' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in load' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:inload_rakefile' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/application.rb:501:in raw_load_rakefile' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/application.rb:82:inblock in load_rakefile' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/application.rb:81:inload_rakefile' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/application.rb:65:in block in run' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:instandard_exception_handling' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in run' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/bin/rake:33:in' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/rake:19:in load' /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/rake:19:in'

I also tried to modify my Gemfile by adding

gem "rake", "0.9.2.2"

But then I get this:

Z-Kidds-MacBook-Air:first_app zkidd$ rake db:migrate WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead. at /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/rdoctask.rb WARNING: Global access to Rake DSL methods is deprecated. Please include ... Rake::DSL into classes and modules which use the Rake DSL methods. WARNING: DSL method FirstApp::Application#task called at /Users/zkidd/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/railties-3.0.1/lib/rails/application.rb:214:in `initialize_tasks' Z-Kidds-MacBook-Air:first_app zkidd$

And I am running:

Rails 3.0.1

1

1 Answers

0
votes

In your Gemfile, set the version for rake to from 0.8.7 to 0.9.2.2:

gem "rake", "0.9.2.2"

Then run your update:

bundle update

I actually just solved this issue earlier today in one of my own projects.