2010-12-11 28 views
5

Hey folks tôi đang gặp một số vấn đề với rails root routs. Đối với một số lý do tôi không thể có được url gốc (localhost: 3000 /) để định tuyến đến vị trí thích hợp.Rails 3 Root Route issues?

Tôi đã xây dựng một ứng dụng hoàn toàn mới và sử dụng giàn giáo để tạo mô hình "câu hỏi". Tôi có thể khẳng định rằng "chỉ số" hành động tồn tại (theo mặc định từ giàn giáo)

Đây là mã của tôi:

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

Rake đường 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"} 

vấn đề là gì đây? Tại sao localhost: 3000/cho tôi thông điệp "welcome to rails"?

+2

Bạn đã xóa tệp /public/index.html chưa? – jyoseph

Trả lời

30

Bạn cần xóa public/index.html - nó sẽ có ưu tiên hơn hành động gốc của bạn.

+0

WOW Làm thế nào tôi quên điều đó! Tôi đoán tôi sẽ không bao giờ một lần nữa. Cảm ơn! – jsfour

+0

chết tiệt đây cũng là vấn đề của tôi ... doh. Cảm ơn – notaceo

+0

điều này đã làm việc, tự hỏi tại sao điều này không được chấp nhận là câu trả lời –