0

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

我的应用程序将 Authlogic 用于身份验证系统,它非常适合用户登录/注销和注册。但是,在我按照该教程进行操作后(password_reset 控制器重命名为“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

4

1 回答 1

1

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

class Notifier < ActionMailer::Base  

  def password_reset_instructions(user)

  end

end

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

于 2010-07-20T22:12:35.263 回答