views:

196

answers:

1

Hey all

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

+1  A: 

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.

bjg
Wow, this is quite a 'face-palm' moment. It must have been one of those times where you can't see the solution no matter how simple it is or how much you look until you take a break. I feel slightly stupid now, thanks for the insight!
Verloren
@Verloren You're welcome. We've all been there one time or another.
bjg