问题描述
我有一个带有字符串列 access 的 Document 模型和一个带有 team 字符串列的 User 模型。在文档中,我可以输入用于访问的一系列项目,例如工作人员,销售人员,经理。同时,用户在团队下只有一个项目。
I have a Document model with a string column access and a User model with a string column team. In a Document I can enter an array of items for access such as "staff, sales, manager". Meanwhile, a User has only one item under team.
我正在尝试根据是否每个 user.team 是否包含在 Document.access 的数组中,向特定用户发送电子邮件。
I am trying to send emails to specific Users based on whether or not for each user.team is included in the array for Document.access.
例如,如果 Document.access =销售,管理
,则只有拥有 team =的用户销售或团队=管理
会收到电子邮件。
For example if Document.access = "sales, management"
, only Users with team = "sales" or team = "management"
will be sent the email. Other Users such as team = "accounting" would not.
根据我在此三角红宝石旅亲自回答了我的问题。我认为有时走出房子很有帮助。
Credit goes to a very nice Nathaniel Talbott of Triangle Ruby Brigade who answered my question in person. I guess it helps to get out the house sometimes.
这篇关于Rails Actionmailer根据数组中包含的User属性通过电子邮件发送特定的用户组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!