1

我遵循了基本安装(http://railscasts.com/episodes/67-restful-authentication

这样做:

1.) ruby​​ 脚本/生成经过身份验证的用户会话

2.) ruby​​ 脚本/生成经过身份验证的用户会话rake db:migrate

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 

问题是在localhost:3000/上出现了与通常相同的 “欢迎加入您正在使用 Ruby on Rails!”页面。

如何将登录页面显示在localhost:3000上?

4

3 回答 3

9

从您的 Rails 应用程序中删除 public/index.html 并更改您的 routes.rb

map.root :controller => 'session', :action => 'new'

于 2009-07-07T11:58:30.343 回答
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'

map.root您的 routes.rb 文件中可能已经注释掉了。

于 2009-07-07T11:55:36.870 回答
0

你有吗

before_filter :login_required

在每个需要身份验证的控制器中。同样正如 Srinvis 上面提到的,如果您收到“欢迎加入您正在使用 Ruby on Rails!” 消息您需要删除 public/index.html 文件。确保将其从文件系统中删除,而不仅仅是 textmate(如果您使用的是 textmate)

于 2009-08-07T10:17:51.757 回答