5
votes

Hey folks i am having some issues with rails root routs. For some reason I can not get root url (localhost:3000/) to route to the appropriate place.

I have built a brand new app and used scaffold to generate the "questions" model. I can confirm that the"index" action exists (by default from scaffold)

Here is my code:

Fbauth::Application.routes.draw do
  resources :questions
  root :to => 'questions#index'
end

Rake Routes Output:

 (in /home/jsfour/rails3_apps/fbauth)
    questions GET    /questions(.:format)          {:action=>"index", :controller=>"questions"}
              POST   /questions(.:format)          {:action=>"create", :controller=>"questions"}
 new_question GET    /questions/new(.:format)      {:action=>"new", :controller=>"questions"}
edit_question GET    /questions/:id/edit(.:format) {:action=>"edit", :controller=>"questions"}
     question GET    /questions/:id(.:format)      {:action=>"show", :controller=>"questions"}
              PUT    /questions/:id(.:format)      {:action=>"update", :controller=>"questions"}
              DELETE /questions/:id(.:format)      {:action=>"destroy", :controller=>"questions"}
         root        /(.:format)                   {:controller=>"questions", :action=>"index"}

What is the problem here? Why is localhost:3000/ giving me the "welcome to rails" message?

1
Have you deleted your /public/index.html file?jyoseph

1 Answers

31
votes

You need to delete public/index.html - it will have priority over your root action.