Ruby on Rails Routing

1

I'm having trouble setting the home page as root in my application.

In the file config/routes.rb I have already made several attempts like:

root :to => 'static_pages#home'

and

root   'static_pages#home'

But none works, I'm working with it like this:

get 'home' => 'static_pages#home'

What is the correct syntax for by as root?

    
asked by anonymous 14.04.2016 / 20:10

1 answer

2

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

It can be root to: 'static_pages#home' or root 'static_pages#home' .

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

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

    
15.04.2016 / 01:41