"Now if you navigate to http://localhost:3000 in your browser, you’ll
see Hello, Rails"
I get a page that says:
"
Routing Error
uninitialized constant WelcomeController
"
To reproduce:
rails new blog
cd blog
bundle install
rake db:create
rails server
rails generate controller home index
app/views/home/index.html.erb -> <h1>Hello, Rails!</h1>
rm public/index.html
root :to => "home#index" uncommented in routes.rb
Mac OS X 10.6
Rails 3.0.1
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
rake, version 0.8.7
Bundler version 1.0.5
I pretty much did the same, except I didn't bundle.
I worked round the issue (something to add to the guide maybe!).
Things I did to bodge:
1) I had to use the "script/server" to run ruby rails on localhost:
3000
2) I had to use the "script/generate" to generate the scaffolding
3) I had to edit "config/routes.rb" so.. map:root controller: =>
"home"
4) I had to manually edit the app/controller/home_controller.rb..
class HomeController < ApplicationController
def index
render "home/index"
end
end
Obviously making sure app/views/home/index.html.erb exists, with the
basic HTML in.
1-3) If you had to use the script/* commands then it appears that you’re using an older version of Rails, something that’s pre-3. Same goes for your routing syntax.
In all versions of Rails that I’m aware of, you don’t need to render “home/index” as this is implicit.
Thanks for the info Ryan. This is not the topic of the original post
and neither am I the original poster, so I feel a bit jump-horse-y-
ish. I did a.. sudo gem update --system and all seems ok.