FIX: TypeError: wrong argument type nil (expected Module)

April 29th, 2009

If you were using an old ARMailer gem, then removed it and installed another, more frequently updated version, (eg, “adzap-ar_mailer” from Github), you might receive the following error when attempting to send mail:

TypeError: wrong argument type nil (expected Module)
from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/helpers.rb:109:in `extend’
from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/helpers.rb:109:in `initialize_template_class’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/object/misc.rb:39:in `returning’
from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/helpers.rb:108:in `initialize_template_class’
from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:564:in `render’
from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:552:in `render_message’
from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:493:in `create!’
from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:452:in `initialize’
from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:395:in `new’
from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:395:in `method_missing’
from (irb):3

The solution is to change the class the model derives from, in your model class, the first line of your model file changes like so:

-class Emailer < ActionMailer::ARMailer
+class Emailer < ActionMailer::Base

Categories: Rails

Tags: , , , Leave a comment

Like This Post?

Subscribe for more...
Feed

http://www.mendable.com / FIX: TypeError: wrong argument type nil (expected Module)