Forum: Ruby on Rails error when rendering partial from an email 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.
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 Peter Michaux (Guest)
on 2006-04-07 06:18
(Received via mailing list)
Hi,

For an ecommerce application, I am trying to create an html email that
summarizes a customers order. (This is very similar to the Agile Rails
book page 417.) My templates are in two directories.

views/
  order_mailer/
    sent.rhtml
  store/
    _order_summary.rhtml
    _line_item.rhtml

sent.rhtml needs to render the _order_summary.rhtml partial which
needs to render the _line_item.rhtml summary.

If I do the following in sent.rhtml I get an error that Rails can't
find a partial named order_summary

render(:partial=>"store/order_summary")

I can make Rails find the partial if I do

render(:partial=>'../store/order_summary')

but now the order_summary partial cannot find the line_item partial.

I assume now I have to change the render partial calls in
order_summary to have complete, explicit paths. This seems like a bit
of a kludge. Is there a way to avoid going through all my partial
calls in order_summary and giving every render partial an explicit
path?

Thanks,
Peter
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 Peter Michaux (Guest)
on 2006-04-07 06:42
(Received via mailing list)
It is even worse than this. If I do add absolute paths for all the
partials. The rails templates cannot find the helper functions. There
must be a known solution for this problem. I hope!

Thanks,
Peter
This topic is locked and can not be replied to.