Topic: Root issue

Hello everyone! I currently follow a RoR tutorial for a few weeks (that of Michael Hartl), but now I am facing a problem :
- I have written in routes.rb the following line : root: to => 'pages#home'
- I also removed public/index.html
But the home page of my application is still the default "Welcome aboard" when I go to localhost:3000

Yet when I go to another page and I created a link with <% = link_to "Home", root_path %> It works : I reach the desired page

Thank you in advance for your explanations !

Last edited by Marty76 (2013-04-28 10:49:44)

Re: Root issue

Try

root :to => "home#page"

Be careful where you put colon(:) and blank spaces.

It is not "root:" followed by a blank space and "to=>controller#action" but "root" followed by a blank space then the symbol ":to" (colon to) and no spaces between the controller name and the action name ("home#page" instead of "home # page")

Hope this helps

Cheers

PS - To understand how routing works you should read http://guides.rubyonrails.org/routing.html

Last edited by anso (2013-04-28 10:56:57)

Re: Root issue

Great ! It's ok now ! Thanks a lot