ActiveRecord where field = ? array of possible values

后端 未结 6 1188
無奈伤痛
無奈伤痛 2020-12-13 07:47

I want to do

Model.where(\'id = ?\', [array of values])

How do I accomplish this look up without chaining OR statements together?

6条回答
  •  余生分开走
    2020-12-13 08:32

    If you are looking for a query in mongoid this is the oneModel.where(:field.in => ["value1", "value2"] ).all.to_a

提交回复
热议问题