Forum: Ruby on Rails Application-specific e-mail template engine

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.
96956a77a329c7f8622e7c81396655fd?d=identicon&s=25 Justin Williams (Guest)
on 2007-03-05 21:24
(Received via mailing list)
Does anyone have any experience with creating a templating system for
e-mails sent via Rails?  Here is what I'd like to do:

1. User selects "Create message" from my application
2. User selects a predefined template from dropdown list.
3. Selected template populates the message field with the template
tags replaced with correct values (replacing <%= @tutor.name %> with
John Doe for example)

The issue I am running into is I am not sure if I can use standard
RHTML or ERB templates to define the Mail templates.  If I can, I am
not sure how to replace the <% %> fields with the correct values on
the fly.

If anyone has any experience with a solution like this, I am all ears.

Thanks.

- j
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2007-03-05 21:30
(Received via mailing list)
On 3/5/07, Justin Williams <carpeaqua@gmail.com> wrote:
> The issue I am running into is I am not sure if I can use standard
> RHTML or ERB templates to define the Mail templates.  If I can, I am
> not sure how to replace the <% %> fields with the correct values on
> the fly.
>
> If anyone has any experience with a solution like this, I am all ears.

I believe shopify uses Liquid templates for this.  If it doesn't,
Liquid would still be a good fit.  Executing pure ruby (erb) from
something a user entered is usually not a good thing.

--
Rick Olson
http://weblog.techno-weenie.net
http://mephistoblog.com
96956a77a329c7f8622e7c81396655fd?d=identicon&s=25 Justin Williams (Guest)
on 2007-03-05 22:07
(Received via mailing list)
Thanks Rick.  I will look into it.

- j
This topic is locked and can not be replied to.