# Render Partial for Email Template

> A workaround for rendering partials inside Rails mail templates using relative paths

- Author: Curtis Miller
- Published: 2006-11-30
- Categories: rails, how-to
- Canonical URL: https://millarian.com/posts/render-partial-for-email-template/

As I create more automated email responses for my system, I realized I should follow the DRY (Don't Repeat Yourself) principle. So I started down a path to create a separate file containing a header and footer for my emails. At least that part I could rip out, right? Well…not exactly.

Turns out that rendering from within a mail template is not yet supported. In fact there is a [Rails ticket](http://dev.rubyonrails.org/ticket/2926) open to address it, but it has not been corrected yet.

So, what to do? A [suggestion from the Ruby Forums](http://www.ruby-forum.com/topic/59024) from the forums involves using a relative path when invoking render. For example:

```erb
<%= render :partial => '../foo' %>
```

Where ‘foo' refers to ‘\_foo.rhtml' in the ‘app/views/' directory. This seems to work for me, but apparently this is only a workaround.

Hopefully this will be helpful to someone else who has the same problem.
