1
votes

I'm following Ruby on Rails Tutorial: Learn Rails by Example, by Michael Hartl.

http://ruby.railstutorial.org/chapters/a-demo-app#sec:a_micropost_microtour

Problem started: So, when I typed:

$ rails generate scaffold Micropost content:string user_id:integer

the command went through fine.

However, when I typed: $ bundle exec rake db:migrate

I get the errors below:

K-MacBook-Pro:demo_app ka$ bundle exec rake db:migrate
WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require
'rdoc/task' (in RDoc 2.4.2+)' instead.
   at /Users/ka/.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 DemoApp::Application#task called at
/Users/ka/.rvm/gems/ruby-1.9.2-p290@global/gems/railties-3.0.1/lib/rails/application.rb:214:in
`initialize_tasks'
==  CreateUsers: migrating ====================================================
-- create_table(:users)
  -> 0.0023s
==  CreateUsers: migrated (0.0024s) ===========================================

Info:

Rails -v: 3.0.1
gem list:
abstract (1.0.0 ruby)
actionmailer (3.0.1 ruby)
actionpack (3.0.1 ruby)
activemodel (3.0.1 ruby)
activerecord (3.0.1 ruby)
activeresource (3.0.1 ruby)
activesupport (3.0.1 ruby)
addressable (2.2.6)
arel (1.0.1 ruby)
builder (2.1.2 ruby)
bundler (1.0.21)
erubis (2.6.6 ruby)
heroku (2.17.0)
i18n (0.4.2 ruby)
json (1.6.3)
launchy (2.0.5)
mail (2.2.19 ruby)
mime-types (1.17.2 ruby)
polyglot (0.3.3 ruby)
rack (1.2.4 ruby)
rack-mount (0.6.14 ruby)
rack-test (0.5.7 ruby)
rails (3.0.1 ruby)
railties (3.0.1 ruby)
rake (0.9.2.2, 0.8.7 ruby)
rdoc (3.12)
rest-client (1.6.7)
rubyzip (0.9.5)
sqlite3 (1.3.3)
sqlite3-ruby (1.3.3, 1.2.5 ruby)
term-ansicolor (1.0.7)
thor (0.14.6 ruby)
treetop (1.4.10 ruby)
tzinfo (0.3.31 ruby)

What I have tried:

I copied "gem "rake", "0.8.7"" to my Gemfile I ran bundle update rake Then I tried: $ bundle exec rake db:migrate (in /Users/ka/rails_projects/demo_app) After this it brings me back to the $prompt.

When I open http://localhost:3000/users I get the following error:

Routing Error No route matches "/users" No route matches "/Users"

1
I don't see any errors when you run rake db:migrate, only warnings.Andrew Marshall

1 Answers

2
votes

The problem is that you don't have any path setup in config/routes.rb for Users.

If User is a resource, you can add the following to the file:

# config/routes.rb
resources :users

This will allow you to use your /users, users_path, user_path(@user), etc.

The rdoc warnings you are getting are just that, warnings. They are most likely due to a gem that needs updating (on their end). Keep your gems up to date whenever you can, and you will eventually see that warning go away (most likely).