[英]how to change route with rails 4.2,1/ruby 2.2.1?
I'm attempting to change the route for an Rails app that I'm building. 我试图更改正在构建的Rails应用程序的路由。 I'm using c9.io's IDE.
我正在使用c9.io的IDE。
The route folder has the following code: 路由文件夹具有以下代码:
Rails.application.routes.draw do
get 'home/index'
end
When I change it to: 当我将其更改为:
Rails.application.routes.draw do
get 'home#index'
end
So that I can route the index page to the home page it produces an error. 这样我可以将索引页面路由到主页,这会产生错误。
Do I need to change the code in my controller or view files? 我是否需要更改控制器中的代码或查看文件?
I think you're trying to do this. 我认为您正在尝试这样做。 You want to root the
"/"
page to the home controller index action? 您想将
"/"
页面作为根控制器索引操作的根吗?
Rails.application.routes.draw do
root to: 'home#index'
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.