Thinking about implementing of (a little bit) smarter notification system in my project.
What I’d like to do is emailing user about few new let’s say private messages once within certain range of time rather than each time he gets new message.
Of course there will not be without delayed_job, but here I’ve got a couple of etic questions about ActionMailer:
- How many logic you can put in Mailer class?
- Can I perform database queries within Mailer class methods?
I would suggest keeping ActionMailer logic to a bare minimum: just rendering the email and doing the actual delivery.
Yes I realize this makes the delayed_job logic slightly more complicated since you can’t just send a delayed email, but it keeps the logic where it should be.