通过单击我的应用程序中的按钮,用户可以“邀请”另一个人加入。扫描地址簿中的电子邮件联系人,他们可以从列表中单击要向其发送电子邮件的人。
目前屏幕看起来是这样的:
基本上,我想要“已经被很酷的应用程序使用!” 仅当此人通讯录中的电子邮件已存在于我的数据库中时。知道怎么做吗?
用户的电子邮件在我的数据库中标识为@user.email。我知道我必须做的是'扫描我数据库中的所有@user.emails,如果它们匹配@contact.name 然后显示消息',但不知道如何编码。
我的代码的相关部分是:
<!-- go through all the contacts in a person's email address book -->
<% @contacts.each do |name, value| %>
<div class="email">
<!-- for all the contacts, have a check box, unchecked -->
<%= check_box_tag "contacts[]", value, false, :id => value %>
<!-- make a label with the check box and the person's email
<label for="<%= value %>"><%= name %></label>
<%= "Already using my cool app!" %>
</div>
<% end %>
谢谢你的帮助!