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
If I’m reading that trace properly then it looks to me like
password_reset_instructionshas been declared as a no-argument method. That’s what the(1 for 0)complaint is about. Can you check that you have included theuserargument in the definition, as below?If you’ve been staring at it for hours it’s probably not that simple but worth making sure.