Forum: Ruby on Rails ActionMailer rhtml in deep file hierarchy bad?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
A458c4d941f0a6f5b01d924c1c3fc004?d=identicon&s=25 Brian Jones (Guest)
on 2007-04-14 03:29
(Received via mailing list)
I have a big project I am working on, and like to use file hierarchy
conventions to keep portions of the system separated.  I ran the
following command:

bojo@boji:~/Development/rails/ims$ ruby script/generate mailer work/
      create  app/models/work/mail
      create  app/views/work/mail/notifier
      create  test/unit/work/mail
      create  test/fixtures/work/mail/notifier
      create  app/models/work/mail/notifier.rb
      create  test/unit/work/mail/notifier_test.rb

Added a method to my model:

class Work::Mail::Notifier < ActionMailer::Base

    def project_notification(user)
        recipients  user[:email]
        from        ""
        subject     "Test Mail"
        # body        "user" => user
        body        "Test Mail Body"


And called it from a controller:


This all works fine without calling an actual .rhtml template.
However, when I replaced the body method with something that passes
instance variables, I get the following error:

ActionView::ActionViewError (No rhtml, rxml, rjs or delegate template
found for project_notification):
base.rb:389:in `find_template_extension_for'
base.rb:325:in `pick_template_extension'
base.rb:240:in `render_file'
base.rb:274:in `render'

(etc, etc, etc)

I do have a template located at:


Am I missing something here, or is the ActionMailer not capable of
referencing the .rhtml file right?


Brian Jones
This topic is locked and can not be replied to.