Forum: Ruby on Rails actionmailer - TypeError: can't dup NilClass

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fddbb3cd16868f4741c2e86ef015a639?d=identicon&s=25 Sergio T. Ruiz (sergio101)
on 2009-03-09 16:04
i am currently writing a mailer, and running into several problems
that i have not run into before..

suddenly, rails is asking me for the following:

ActionView::ActionViewError (Due to changes in ActionMailer, you need to
provide the mailer_name along with the template name.

i have changed my my file model to look like this:

,----[ notifier ]
| class Notifier < ActionMailer::Base
|   def files_expiring(user_id)
|     recipients 'email@address.com'
|     bcc "email@address.com"
|     from "email@address.com"
|     subject "some subject"
|     render :file => "notifier/expire_files"
|   end
| end
`----

when i run this, everything seems to be okay, but i get the following
error:

,----[ error message ]
| >> Notifier.deliver_files_expiring(25)
| Notifier.deliver_files_expiring(25)
| TypeError: can't dup NilClass
|   from 
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/template_error.rb:11:in `dup'
|   from 
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/template_error.rb:11:in 
`initialize'
|   from /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:322:in `new'
|   from /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:322:in 
`render_file'
|   from /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:348:in 
`render'
|   from /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:502:in 
`render'
|   from /Users/sergio/Sites/file_manager/app/models/notifier.rb:7:in `files_expiring'
|   from /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:410:in 
`__send__'
|   from /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:410:in 
`create!'
|   from /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:403:in 
`initialize'
|   from /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:352:in 
`new'
|   from /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:352:in 
`method_missing'
|   from (irb):41
`----

at this point, the view has only some text in it, no reference to any
variables..

any help would be greatly appreciated...

thanks!
This topic is locked and can not be replied to.