Forum: Ruby on Rails Help for ActionMailer!

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.
klaus.kohlbauer (Guest)
on 2009-02-12 17:59
(Received via mailing list)
Hello,

I have a big problem und hoping for your help.

In my application a user should be able to edit an email template file
for himself and send it out e.g. to a customer. (thats the plan).

For that I have created some functionality to edit the template file
and an ActionMailer class with a method called 'createMail'. The user
is editing the template file, saves the file and then he is sending
the mail to the customer. Thats working fine. But now the user is
making changes on the template file and he wants to send it out
again.  And now my problem comes up. The result of createMail() is the
same as it was for the first time. The changes, the user has made in
the template file are not in the created email.

I think that has something to do with caching. Because all is working
well in the development environment but not in production.

Is there anyone who can help. Is there a possibility to force the
system to use the newer version of the template file and not to be
'proud' of an old file.

If I can get any help you will get an invitation to the octoberfest in
munich/bavaria/germany later this year :)

Best regards
Klaus Kohlbauer

infosense gmbh
Infanteriestrasse 19/5
80797 München
Telefon Büro: +49 89 12 11 35 59
Telefon Mobil: +49 173 999 777 9
Email: removed_email_address@domain.invalid
Web: www.infosense.de
Frederick C. (Guest)
on 2009-02-12 18:04
(Received via mailing list)
On Feb 12, 3:18 pm, "klaus.kohlbauer" <removed_email_address@domain.invalid>
wrote:
> the mail to the customer. Thats working fine. But now the user is
> making changes on the template file and he wants to send it out
> again.  And now my problem comes up. The result of createMail() is the
> same as it was for the first time. The changes, the user has made in
> the template file are not in the created email.
>
> I think that has something to do with caching. Because all is working
> well in the development environment but not in production.

You might be interested in
http://groups.google.com/group/rubyonrails-core/br...
They're talking about actioncontroller views rather than actionmailer
views but it's all the same really.

What I've done in the past is just sidestep this completely with a
mailer method like this:

  def standard_email(recipient, template)
    setup_common(recipient)
    @subject = template.subject
    @body = Liquid::Template.parse(template.body).render({})
  end

template is an activerecord object holding the body, subject etc. of
the message. I happened to use Liquid to render the message, but
that's up to you. You could read templates from disk rather than from
database.

Fred
klaus.kohlbauer (Guest)
on 2009-02-13 10:12
(Received via mailing list)
Sound good - I will try it. Thanks.
Klaus Kohlbauer

On 12 Feb., 17:04, Frederick C. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.