Forum: Ruby on Rails render :partial in mail template

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.
B9a732fc30c32098347a0177c75ee27b?d=identicon&s=25 jeroen (Guest)
on 2005-11-17 16:41
(Received via mailing list)
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
992fe8c19bbbc27f2b562a9f96efc03d?d=identicon&s=25 jamis (Guest)
on 2005-11-17 16:50
(Received via mailing list)
On Nov 17, 2005, at 8:38 AM, Jeroen Houben wrote:

> 5:
> 6: <%= @url %>
> 7:
> 8: <%= render_partial 'sig_admin' %>
>

Could you file this as a bug on dev.rubyonrails.com? It looks like I
need to do a bit more work to make ActionMailer quack like an
ActionController...

- Jamis
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 Joe Van Dyk (Guest)
on 2005-12-30 23:40
(Received via mailing list)
On 11/17/05, Jamis Buck <jamis@37signals.com> 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? 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.
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 Joe Van Dyk (Guest)
on 2005-12-30 23:55
(Received via mailing list)
On 12/30/05, Joe Van Dyk <joevandyk@gmail.com> 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 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.
6828ffc79486cd2442714bf32286a910?d=identicon&s=25 Vivek Krishna (Guest)
on 2005-12-31 04:50
(Received via mailing list)
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
B554bcde846e4497eeffffc1399d3b09?d=identicon&s=25 Benjamin Stiglitz (Guest)
on 2005-12-31 07:03
(Received via mailing list)
> 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       "system@example.com"
     end

     # explicitly specify multipart messages
     def signup_notification(recipient)
       recipients      recipient.email_address_with_name
       subject         "New account information"
       from            "system@example.com"

       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
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 Joe Van Dyk (Guest)
on 2005-12-31 10:50
(Received via mailing list)
On 12/30/05, Vivek Krishna <krishna.vivek@gmail.com> 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.
C184e9c72fc1edc3e3edc3bec403a7a0?d=identicon&s=25 Mohammed Saleem (Guest)
on 2005-12-31 11:20
(Received via mailing list)
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
This topic is locked and can not be replied to.