帮助进行 Rails Restful 身份验证

发布于 2024-08-10 12:50:15 字数 280 浏览 3 评论 0原文

我刚刚使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

故事和酒 2024-08-17 12:50:15

首先,如果您刚刚开始使用 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.

千と千尋 2024-08-17 12:50:15

Railscasts 网站上提到了这一点...

试试这个(复数会话):

map.resource :session, :controller => “会话”

This was mentioned on the Railscasts site...

Try this (pluralize sessions):

map.resource :session, :controller => 'sessions'

冰火雁神 2024-08-17 12:50:15

安宁的认证已经迎来了它的一天。使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文