I am working with Rails for the first time and got the Apache-Mongrel integration working and have the index.html page showing up when I open localhost in the browser. I created the controller (ruby script/generate controller Welcome index) and renamed the index.html file. However, when I try to map to a 开发者_JAVA百科controller in routes.rb (map.root :controller => "welcome") things break. I can start the ruby server (ruby script/server) and browse to localhost:3000 works.
You are making a reference to a controller named "Welcome". Renaming the Html file in the public folder is useless. You should create a controller called "Welcome " and then add a method, such as "index".
And then in the routes.rb file you should add: "map.root: controller => 'welcome',: action => 'index'"
Delete index.html file too, it will prevent your routes from working.
精彩评论