2009-07-07 48 views
1

我已經遵循的基本安裝目錄(http://railscasts.com/episodes/67-restful-authenticationrestful_authentication沒有出現

這樣做:

1)Ruby腳本/生成驗證的用戶會話

2)Ruby腳本/生成驗證的用戶會話耙分貝:遷移

3)在文件application_controler.rb我已經包含

include AuthenticatedSystem 

4)在的routes.rb我已經包括

map.signup '/signup', :controller => 'users', :action => 'new' 
map.login '/login', :controller => 'session', :action => 'new' 
map.logout '/logout', :controller => 'session', :action => 'destroy' 
map.activate '/activate/:activation_code', :controller => 'users', :action => 'activate', :activation_code => nil 

問題的文件是在本地主機:3000/出現相同的通常的 「 」 歡迎您乘坐'再騎Ruby on Rails!「 page。

如何將登錄頁面出現在localhost:3000

回答

0

您可以添加到您的routes.rb:

# You can have the root of your site routed with map.root -- just remember to delete public/index.html. 
map.root :controller => 'session', :action => 'new' 

有可能在你的routes.rb文件中註釋掉map.root了。

+0

Didnt Work ...我該怎麼辦? – Bonfocchi 2009-07-07 13:05:12

+0

它沒有工作,因爲沒有什麼區別嗎?還是不工作,因爲在返回一個錯誤? 我的'會話'控制器實際上是'會話',我只是使用'sesson',因爲這就是你的代碼。也許值得一試:如果你得到一個錯誤「未初始化的常量SessionController」,controller =>'sessions'。否則,瞭解它是如何失敗會很有用。 – Shadwell 2009-07-07 15:59:47

9

從Rails應用程序中刪除公共/ index.html,將您的routes.rb

map.root:控制器=> '會議',:動作=> '新'

0

你有

before_filter :login_required 

在每個需要驗證的控制器中。 Srinvis還提到,如果你得到「歡迎登上你正在騎Ruby on Rails!」您需要刪除public/index.html文件。確保從文件系統中刪除它,而不僅僅是文本(如果你使用的是textmate)