决定尝试学习 RoR。卡在了 Rails Guides 的开头.
一切都和教程中的完全一样(除了 del public/index.html
而不是 rm public/index.html
,因为我有一个窗口)检查本地主机并获取:
No route matches [GET] "/"
最佳答案
您的网站需要某种根。如果 public/中不存在某些索引文件(index.html|htm、default.html|htm 等),那么您需要告诉您的 Rails 应用程序去哪里。
您可以通过编辑 routes.rb(在您的 config/文件夹中找到)并添加行来完成此操作
root :to => 'somecontroller#index"
somecontroller
表示要使用的 Controller ,index
表示它应该处理的方法。通常首选索引,它将呈现 index.html.erb
您可以通过输入
找到更多关于路线的信息rake routes
在您的控制台中。
关于ruby-on-rails - 你好, rails !没有路由匹配 [GET] "/",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17181859/