I have a pretty standard mailer class with the following method:
def request(contact_us)
@contact = contact_us
mail(:to => "customercare@our_co.com", :subject => @contact.subject, :from => @contact.email)
end
The error I'm getting is:
wrong number of arguments (0 for 1)
My first thought that is was the argument being passed in but some debugging/specs confirm the error occurs on the line with mail(:to. The whole trace is below, line 9 is where the method is defined and line 11 is the mail method. I looked through the rails code and this is the method that's actually bailing in ActionView::Base
assign_controller(controller)
Any thoughts or suggestions? I have also tried RC5 with the same result.
Thanks!
ArgumentError: wrong number of arguments (0 for 1)
from /Users/user/Git/projects/app/mailers/notifier.rb:9:in request'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionpack-3.1.0.rc4/lib/action_view/helpers/controller_helper.rb:15:in
assign_controller'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionpack-3.1.0.rc4/lib/action_view/base.rb:212:in initialize'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionpack-3.1.0.rc4/lib/abstract_controller/rendering.rb:87:in
new'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionpack-3.1.0.rc4/lib/abstract_controller/rendering.rb:87:in view_context'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionpack-3.1.0.rc4/lib/abstract_controller/rendering.rb:120:in
_render_template'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionpack-3.1.0.rc4/lib/abstract_controller/rendering.rb:114:in render_to_body'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionpack-3.1.0.rc4/lib/abstract_controller/rendering.rb:99:in
render'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionmailer-3.1.0.rc4/lib/action_mailer/base.rb:717:in block in collect_responses_and_parts_order'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionmailer-3.1.0.rc4/lib/action_mailer/base.rb:728:in
each'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionmailer-3.1.0.rc4/lib/action_mailer/base.rb:728:in each_template'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionmailer-3.1.0.rc4/lib/action_mailer/base.rb:713:in
collect_responses_and_parts_order'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionmailer-3.1.0.rc4/lib/action_mailer/base.rb:652:in mail'
from /Users/user/Git/projects/app/mailers/notifier.rb:11:in
request'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionpack-3.1.0.rc4/lib/abstract_controller/base.rb:167:in process_action'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionpack-3.1.0.rc4/lib/abstract_controller/base.rb:121:in
process'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionpack-3.1.0.rc4/lib/abstract_controller/rendering.rb:45:in process'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionmailer-3.1.0.rc4/lib/action_mailer/old_api.rb:65:in
process'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionmailer-3.1.0.rc4/lib/action_mailer/base.rb:473:in process'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionmailer-3.1.0.rc4/lib/action_mailer/base.rb:468:in
initialize'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionmailer-3.1.0.rc4/lib/action_mailer/base.rb:455:in new'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/actionmailer-3.1.0.rc4/lib/action_mailer/base.rb:455:in
method_missing'
from (irb):13
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/railties-3.1.0.rc4/lib/rails/commands/console.rb:45:in start'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/railties-3.1.0.rc4/lib/rails/commands/console.rb:8:in
start'
from /Users/user/.rvm/gems/ruby-1.9.2-p290@projects/gems/railties-3.1.0.rc4/lib/rails/commands.rb:40:in <top (required)>'
from script/rails:6:in
require'
request
andnotify
seem to cause problems – Theozaurus