Rails : Why my first page does not show? (routing error)
I use scaffold to create my first MVC in Rails 3.1
rails generate scaffold Post name:string title:string content:text
I deleted the public/index.html file
Then I added following code开发者_JS百科 in config/routes.rb
root :to => 'post#index'
But when I start the server with rails s, there is an error:
ActionController::RoutingError (uninitialized constant PostController):
Why? why it does not render the posts/index.html.erb but throw the error?
It created PostsController, not PostController. It's plural.
Change your routes.rb file to this: root :to => 'posts#index'
EDIT: I didn't see the OP's comment.
Did you run rake db:migrate first?
加载中,请稍侯......
精彩评论