1

我正在尝试一次更新多个用户属性。Rails 有没有办法通过电子邮件找到多个用户?例如 User.find_by_email(joe@example.com, tom@example.com) 我在 heroku 控制台中写了这个,但它不起作用。我知道在 Rails 中,find 方法接受一组数字作为我希望电子邮件相同的 id。

4

2 回答 2

3

rails 3 中的正确语法是这样的:

User.where(:email => ["joe@example.com", "tom@example.com"])
于 2012-09-19T19:42:44.697 回答
2

User.find_all_by_email( ["joe@example.com", "tom@example.com"] )

于 2012-09-19T19:40:00.390 回答