Topic: ActionMailers mail method in rails3

Hi all,

i am upgrading to rails3 and refactoring my Mailer class in this moment.

In it, i have 2 methods like this one:

def confirmation(user, pass)
    @user = user
    @pass = pass
    
    mail(:to => user.email)
end

and a default hash with:

default :from => "webmaster@blabla.net",
          :subject => 'registration'

and a template called confirmation.text.erb containing the body.


But when testing the mail, i get an error with the message:

ArgumentError: wrong number of arguments (0 for 1)
    app/mailers/register_email.rb:10:in `confirmation'

Anyone knows what i am doing wrong ?

Thanks !

Martin

[edit] line 10 is the line where i call the mail-method

Last edited by maltin (2011-01-03 10:29:50)

Re: ActionMailers mail method in rails3

Ok stupid error, after trial and error for hours i found out that i have overwritten the "message"-method in ActionMailer::Base..

Re: ActionMailers mail method in rails3

Just to make you feel not too stupid. I had the same problem. Thanks for pointing me in the right direction.

The thing is, the message   

ArgumentError: wrong number of arguments (0 for 1)
    app/mailers/register_email.rb:10:in `confirmation'

does not really help now does it.

Last edited by westghost (2011-01-22 06:22:09)

Re: ActionMailers mail method in rails3

I had the same problem too. Thanks for posting the solution.