Rails Routing (root :to => ...) Rails Routing (root :to => ...) ruby ruby

Rails Routing (root :to => ...)


Had this same problem and this worked for me:

root :to => "pages#show", :id => '1'


As of Rails 4.0, you can declare the root route like this:

root 'controller#action'


I'm using Rails 5.1 to point the home page to a specific blog. In config/routes.rb I have ...

root 'blogs#show', {id: 1}

This will point the root route to /blogs/1

I'm doing this on a blog site I'm building. The first blog will be the main site blog as well as the homepage.

Cheers