Ruby on rails应用程序root

Bee*_*Bee 5 routes ruby-on-rails

如何更改rails应用程序以使控制器foo显示为应用程序根目录?

换句话说,现在所有的网址看起来像host.com/foo/...我想摆脱foo,只需要host.com/...

Abi*_*bie 8

在routes.rb中,添加:

map.root :controller => 'foo'
Run Code Online (Sandbox Code Playgroud)

API中的完整详细信息.

  • 不要忘记还删除rails附带的index.html页面!(http://stackoverflow.com/questions/1205033/ruby-on-rails-map-root-doesnt-seem-to-be-working) (2认同)