忘记密码和 authlogic 的问题

发布于 2024-09-10 20:32:26 字数 1282 浏览 4 评论 0原文

我在忘记密码系统时遇到一些问题 教程

我的应用程序使用 Authlogic 作为身份验证系统,它非常适合用户登录/注销和注册。然而,在我严格按照该教程进行操作(password_reset 控制器重命名为“重置”,并且我使用了自己现有的邮件程序配置),并尝试重置我的测试帐户密码时,我收到“错误数量的参数 1 代表 0”错误我的重置控制器的创建操作。

ArgumentError in ResetsController#create
wrong number of arguments (1 for 0)

c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:462:in `password_reset_instructions'
c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:462:in `__send__'
c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:462:in `create!'
c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:455:in `initialize'
c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:392:in `new'
c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:392:in `method_missing'
app/models/user.rb:7:in `deliver_password_reset_instructions!'
app/controllers/resets_controller.rb:12:in `create'

我已经盯着我的代码看了几个小时,尝试了各种调整,谷歌搜索了这个问题,浏览了这个网站,但我仍然不知道为什么会发生这种情况,并且希望你们能提供任何指示。

预先感谢您的帮助!

我正在使用 ruby​​ 1.8.6、Rails 2.2.2 和 Authlogic 2.1.5

I'm having a few problems with the forgot password system from this tutorial.

My application uses Authlogic for the authentication system and it works perfectly for user login/logout and registrations. However after I followed that tutorial to the letter (password_reset controller renamed to 'reset' and I used my own existing mailer configuration), and tried to reset my test accounts password, I get a "wrong number of arguments 1 for 0" error on my reset controller's create action.

ArgumentError in ResetsController#create
wrong number of arguments (1 for 0)

c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:462:in `password_reset_instructions'
c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:462:in `__send__'
c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:462:in `create!'
c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:455:in `initialize'
c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:392:in `new'
c:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:392:in `method_missing'
app/models/user.rb:7:in `deliver_password_reset_instructions!'
app/controllers/resets_controller.rb:12:in `create'

I have stared at my code for a couple of hours, trying various tweaks, Google'd the issue, browsed this site, but I still don't know why this is happening and would appreciate any pointers your guys can provide.

Thanks in advance for your help!

I am using ruby 1.8.6, Rails 2.2.2 and Authlogic 2.1.5

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

清醇 2024-09-17 20:32:26

如果我正确地读取该跟踪,那么在我看来,password_reset_instructions 已被声明为无参数方法。这就是(1 for 0) 投诉的内容。您能否检查一下定义中是否包含了 user 参数,如下所示?

class Notifier < ActionMailer::Base  

  def password_reset_instructions(user)

  end

end

如果您已经盯着它看了几个小时,它可能并不那么简单,但值得确定。

If I'm reading that trace properly then it looks to me like password_reset_instructions has been declared as a no-argument method. That's what the (1 for 0) complaint is about. Can you check that you have included the user argument in the definition, as below?

class Notifier < ActionMailer::Base  

  def password_reset_instructions(user)

  end

end

If you've been staring at it for hours it's probably not that simple but worth making sure.

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