简体   繁体   中英

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. I'm using c9.io's 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM