Problems with the Rails 3 Root Route?

Hi guys, I have problems with rail root routes. For some reason, I cannot get the root url (localhost: 3000 /) to drive to the right place.

I created a completely new application and used the scaffold to create a β€œquestions” model. I can confirm that the action "index" exists (by default from the scaffold)

Here is my code:

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

Exit rake routes:

 (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? Why does localhost: 3000 / give me a welcome to rails message?

+5
source share
1 answer

You need to remove public / index.html - it will take precedence over your root action.

+30
source

All Articles