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 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, notPostController. It’s plural.Change your routes.rb file to this:
root :to => 'posts#index'EDIT: I didn’t see the OP’s comment.