2010-12-09 101 views
1

routes.rb有以下2行:基本的Rails3路線問題?

match "/",   :to => "main#index" 
match "main/index", :to => "main#index" 

當我在瀏覽器中鍵入localhost:3000/main/index我看到正確的頁面(views/main/index.html.erb)。

但是,如果我只輸入localhost:3000,我會看到public/index.html(我希望看到views/main/index.html.erb以及)。

我錯過了什麼?

回答

2

刪除public/index.html

rm public/index.html 

這是發生,因爲靜態文件(那些public/)優先投放到的路由。

+0

太好了,謝謝! – 2010-12-09 03:33:52