Rails 应用程序中电子邮件频率配置的策略
我期待着允许我的用户配置他们的电子邮件通知频率。
我想为他们提供典型的选项:直接电子邮件、每日和每周摘要
¿在 Rails 3 应用程序中构建此应用程序的最佳策略是什么?
谢谢大家!
I'm looking forward to allowing my users configure their email notifications frequency.
I'd like to offer them the typical options: direct email, daily and weekly digests
¿What would it be the best strategy to build this within a rails 3 application?
Thanks all !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
users
表上有一个email_Frequency_preference
字符串列来存储他们的首选项。然后,您可以通过电子邮件频率首选项找到用户:我还建议使用
Event
模型,其中包含名称和描述,以表示您想要通知用户的可能发生的事件。然后,您可以按创建日期查找事件:现在,您必须分别处理所有三个频率首选项:
每当事件发生时,找到所有喜欢即时事件电子邮件通知的用户并立即将其发送给他们。
在每周结束时,查找该周发生的所有事件:
将他们的描述合并到一封电子邮件中,然后找到所有喜欢每周事件电子邮件通知的用户并将其发送给他们。
在每个月底,查找该月发生的所有事件:
将他们的描述合并到一封电子邮件中,然后找到所有喜欢每月事件电子邮件通知的用户并将其发送给他们。
You could have an
email_frequency_preference
string column on yourusers
table that stores their preference. Then you can find users by their email frequency preference:I also suggest having an
Event
model, with name and description, to represent events that may happen that you want to notify your users of. Then you can find events by their creation date:Now, you have to handle all three frequency preferences separately:
Whenever an event happens, find all users who prefer instant event email notifications and send it to them immediately.
At the end of every week, find all events that happened that week:
Combine their descriptions into a single email, then find all users who prefer weekly event email notifications and send it to them.
At the end of every month, find all events that during happened that month:
Combine their descriptions into a single email, then find all users who prefer monthly event email notifications and send it to them.