开发者

Email Digest for Rail Application

开发者 https://www.devze.com 2023-03-29 17:47 出处:网络
I am working on a rails application where people can follow each other and post comments. Currently I use delayed_jobs for people to get notifications when someone follows them or post a comme开发者_如

I am working on a rails application where people can follow each other and post comments. Currently I use delayed_jobs for people to get notifications when someone follows them or post a comme开发者_如何学编程nt. My question is how can I collect all the notifications for one user and create an email digest for notifications and send the email at the end of the day. Putting it in another way, can we collate the delayed_jobs?


Delayed_job won't do this for you, but it's straightforward enough to do yourself.

The simplest thing to do would be to write a rake task that you run once a day, and have the task find all the activity for that user that has occurred in the past day, and then send them an email about that activity.


Right now you are sending an email on a set of actions (following event or comment event).

Instead, if your user is digest-enabled, insert a record into a pending-email-digest table, and then daily process the email digests via a cron job.

0

精彩评论

暂无评论...
验证码 换一张
取 消