# Render :partial in mail template

**URL:** <https://www.ruby-forum.com/t/render-partial-in-mail-template/70598>\
**Category:** Rails\
**Created:** [November 17, 2005, 4:41pm UTC](https://www.ruby-forum.com/t/render-partial-in-mail-template/70598 "2005-11-17T16:41:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [November 17, 2005, 4:41pm UTC](https://www.ruby-forum.com/t/render-partial-in-mail-template/70598/1 "2005-11-17T16:41:52Z")

</div>

Hi,

Is it possible to render a partial template from within a mail template?  
I get the following error

undefined method `controller\_path’ for SupportMailer:Class

Extracted source (around line #8):

5:  
6: \<%= @url %\>  
7:  
8: \<%= render\_partial ‘sig\_admin’ %\>

Jeroen

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [November 17, 2005, 4:50pm UTC](https://www.ruby-forum.com/t/render-partial-in-mail-template/70598/2 "2005-11-17T16:50:54Z")

</div>

On Nov 17, 2005, at 8:38 AM, Jeroen H. wrote:

> 5:  
> 6: \<%= @url %\>  
> 7:  
> 8: \<%= render\_partial ‘sig\_admin’ %\>

Could you file this as a bug on [dev.rubyonrails.com](http://dev.rubyonrails.com)? It looks like I  
need to do a bit more work to make ActionMailer quack like an  
ActionController…

- Jamis

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 30, 2005, 11:40pm UTC](https://www.ruby-forum.com/t/render-partial-in-mail-template/70598/3 "2005-12-30T23:40:15Z")

</div>

On 11/17/05, Jamis B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Extracted source (around line #8):
> > 
> > 5:  
> > 6: \<%= @url %\>  
> > 7:  
> > 8: \<%= render\_partial ‘sig\_admin’ %\>
> 
> Could you file this as a bug on [dev.rubyonrails.com](http://dev.rubyonrails.com)? It looks like I  
> need to do a bit more work to make ActionMailer quack like an  
> ActionController…

Anyone know the status of this? I’m running into the same problem  
using Rails 1.0.

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 31, 2005, 4:50am UTC](https://www.ruby-forum.com/t/render-partial-in-mail-template/70598/4 "2005-12-31T04:50:38Z")

</div>

Hi Joe,  
An unrelated question … I am trying to use action mailer but I am  
having  
problems with the views … Where exactly do the variables in the view  
come  
from .For example in your code you use @url. Is this an instance  
variable  
you created in your Mailer \< ActionMailer::Base ?  
Thanks  
Vivek

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 30, 2005, 11:55pm UTC](https://www.ruby-forum.com/t/render-partial-in-mail-template/70598/5 "2005-12-30T23:55:17Z")

</div>

On 12/30/05, Joe Van D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > 
> > 
> > ActionController…
> 
> Anyone know the status of this? I’m running into the same problem  
> using Rails 1.0.

I tried to search [dev.rubyonrails.org](http://dev.rubyonrails.org) but couldn’t figure out how to  
search the bug list. I tried filtering, but clicking the ‘plus’  
filter button didn’t seem to do anything remotely useful.

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 31, 2005, 7:03am UTC](https://www.ruby-forum.com/t/render-partial-in-mail-template/70598/6 "2005-12-31T07:03:15Z")

</div>

> I am trying to use action mailer but I am having problems with the  
> views … Where exactly do the variables in the view come from .For  
> example in your code you use @url. Is this an instance variable you  
> created in your Mailer \< ActionMailer::Base ?

They’re defined either as instance variables, or as hash parameters  
to the render\_message() function. For your reference, a large snippet  
from the top of the ActionMailer::Base docs:

class ApplicationMailer \< ActionMailer::Base  
# Set up properties  
# Properties can also be specified via accessor methods  
# (i.e. self.subject = “foo”) and instance variables (@subject =  
“foo”).  
def signup\_notification(recipient)  
recipients recipient.email\_address\_with\_name  
subject “New account information”  
body { “account” =\> recipient }  
from “removed\_email\_address@domain.invalid”  
end

```
 # explicitly specify multipart messages
 def signup_notification(recipient)
   recipients recipient.email_address_with_name
   subject "New account information"
   from "removed_email_address@domain.invalid"

   part :content_type => "text/html",
     :body => render_message("signup-as-html", :account =>

```

recipient)

```
   part "text/plain" do |p|
     p.body = render_message("signup-as-plain", :account =>

```

recipient)  
p.transfer\_encoding = “base64”  
end  
end

-Ben

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 31, 2005, 11:20am UTC](https://www.ruby-forum.com/t/render-partial-in-mail-template/70598/7 "2005-12-31T11:20:41Z")

</div>

Hi all,

I am creating a ruby app which allows users to request changes to the  
DB. The requests will be routed to the DBA and the DBA will authorize  
it. So far good. No issues. The issue arises when I want to give the  
DBA an option of migrating the changes to other schemas as well. How do  
I have more than one schema mapped to one app?

Thanks.

–  
saleem

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 31, 2005, 10:50am UTC](https://www.ruby-forum.com/t/render-partial-in-mail-template/70598/8 "2005-12-31T10:50:32Z")

</div>

On 12/30/05, Vivek K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi Joe,  
> An unrelated question … I am trying to use action mailer but I am having  
> problems with the views … Where exactly do the variables in the view come  
> from .For example in your code you use @url. Is this an instance variable  
> you created in your Mailer \< ActionMailer::Base ?

In whatever Mailer action you’re working with, put

@body[:url] = whatever a url is

Then, in the views, you’ll have access to the @url instance variable.
