Ruby on Rails Routing

Asked

Viewed 46 times

1

I’m having problems to set the home page as root in my application.

in the archive config/routes.rb I’ve made several attempts as:

root :to => 'static_pages#home'

and

root   'static_pages#home'

But none works, I’m working with her that way:

get 'home' => 'static_pages#home'

Which syntax is correct to put as root?

  • You managed to solve the problem?

1 answer

2


According to the documentation Ruby on Rails to create a route to the root just do your second example.

May root to: 'static_pages#home' or root 'static_pages#home'.

Remembering that in this example static_pages would be yours controller and home your action.

Obs: For older versions of Ruby on Rails it is recommended to delete your file "/public/index.html".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.