帮助进行 Rails Restful 身份验证
我刚刚使用 this 插件安装了 Restful 身份验证,当我转到 localhost:3000/login 时 我收到这个错误
SessionController 中的名称错误#new
未初始化的常量 会话控制器
有什么想法吗?请帮忙。
I just installed the restful authentication using this plugin and when I go to localhost:3000/login
i get this error
NameError in SessionController#new
uninitialized constant
SessionController
Any ideas? please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,如果您刚刚开始使用 Rails 身份验证,我强烈建议您使用 Authlogic。 Restful Authentication 曾经有过一段时间,但它生成了大量并不总是清晰的代码,而且很难扩展。
如果您打算使用 Restful Auth,请确保您的会话控制器已创建、路由已存在并且 session_controller.rb 中的操作已创建。
First of all, if you're just getting started with Rails authentication, I'd highly recommend you use Authlogic. Restful Authentication had its time but it generates a lot of code that isn't always clear and it's pretty tough to extend.
If you're set on using Restful Auth, make sure your Session controller is created, the routes are present, and the actions within the session_controller.rb are created.
Railscasts 网站上提到了这一点...
试试这个(复数会话):
map.resource :session, :controller => “会话”
This was mentioned on the Railscasts site...
Try this (pluralize sessions):
map.resource :session, :controller => 'sessions'
安宁的认证已经迎来了它的一天。使用 authlogic 会更好。我在这里写了一篇关于 authlogic 基础知识的小文章。
http://blog.platform45.com/2009/09/ 30/用户身份验证with-authlogic
Restful auth had its day. You'll be better off with authlogic. I wrote a little post here on authlogic basics.
http://blog.platform45.com/2009/09/30/user-authentication-with-authlogic