# ActionMailer rhtml in deep file hierarchy bad?

**URL:** <https://www.ruby-forum.com/t/actionmailer-rhtml-in-deep-file-hierarchy-bad/91993>\
**Category:** Rails\
**Created:** [April 14, 2007, 3:29am UTC](https://www.ruby-forum.com/t/actionmailer-rhtml-in-deep-file-hierarchy-bad/91993 "2007-04-14T03:29:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@brianj](https://www.ruby-forum.com/u/brianj)\
**Post date:** [April 14, 2007, 3:29am UTC](https://www.ruby-forum.com/t/actionmailer-rhtml-in-deep-file-hierarchy-bad/91993/1 "2007-04-14T03:29:42Z")

</div>

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/  
mail/notifier  
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 "removed_email_address@domain.invalid"
    subject "Test Mail"
    # body "user" => user
    body "Test Mail Body"
end

```

end

And called it from a controller:

Work::Mail::Notifier.deliver\_project\_notification(params[:project]  
[:user\_id])

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):  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/  
base.rb:389:in `find_template_extension_for' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/ base.rb:325:in`pick\_template\_extension’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/  
base.rb:240:in `render_file' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/ base.rb:274:in`render’

(etc, etc, etc)

I do have a template located at:

app/views/work/mail/notifier/project\_notification.rhtml

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

Thanks,

Brian J.
