Hi,

I got a mailer that uses dynamic stylesheets, so when creating an
email I'm doing Style.find_by_name("newsletter").

The problem is that it's fetching the same Style record for each email
it creates and when sending newsletters there can be a lot of them. I
could simply fetch this record in controller and just pass it as a
parameter for deliver_email method, but it doesn't seem right for me -
I'd like to keep as much as possible inside mailer class.

I can't also simply put STYLE = Style.find_by_name("newsletter") into
Mailer class, because if admin changes the style, the mailer would
still use cached object.

Is there a *simple* way to do it? This Style object can only be
updated - it can't be destroyed. I'm using Rails 2.1.1.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to