Problem when following http://guides.rubyonrails.org/getting_started.html

Hi,

I’m following instructions at

But I get the following error when I try “rake db:migrate”. Does
anybody know what is wrong in my system?

~/RoR_src/blog$ rake db:migrate --trace
(in /Users/pengy/RoR_src/blog)
rake aborted!
uninitialized constant Rake::DSL
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2503:in
const_missing' /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8 /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in require’
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/testtask.rb:4
/Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/test_unit/testing.rake:2:in
require' /Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/test_unit/testing.rake:2 /Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/test_unit/railtie.rb:12:in load’
/Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/test_unit/railtie.rb:12
/Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/railtie.rb:184:in
instance_exec' /Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/railtie.rb:184:in load_tasks’
/Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/railtie.rb:184:in
each' /Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/railtie.rb:184:in load_tasks’
/Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/engine.rb:423:in
load_tasks' /Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/application/railties.rb:8:in each’
/Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/application/railties.rb:8:in
all' /Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/engine.rb:423:in load_tasks’
/Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/application.rb:145:in
load_tasks' /Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/railtie/configurable.rb:30:in send’
/Library/Ruby/Gems/1.8/gems/railties-3.2.0/lib/rails/railtie/configurable.rb:30:in
method_missing' /Users/pengy/RoR_src/blog/Rakefile:7 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2383:in load’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2383:in
raw_load_rakefile' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2017:in load_rakefile’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in
standard_exception_handling' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2016:in load_rakefile’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2000:in
run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in standard_exception_handling’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:1998:in
`run’
~/RoR_src/blog$ cat Rakefile
#!/usr/bin/env rake

Add your own tasks in files placed in lib/tasks ending in .rake,

for example lib/tasks/capistrano.rake, and they will automatically

be available to Rake.

require File.expand_path(‘…/config/application’, FILE)

Blog::Application.load_tasks


Regards,
Peng

On Fri, Jan 20, 2012 at 9:05 PM, Peng Yu [email protected] wrote:

rake aborted!
uninitialized constant Rake::DSL

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2503:in

`const_missing’

You got to do
gem install rake

or
bundle install
bundle update

unless you want to write this

require 'rake/dsl_definition'

everytime in your rake file, just try to update your rake gem

Javier