查找

2012-06-09 27 views
0

喜歡的東西Model.find(array_of_ids, :conditions => {:attribute => "something"})查找

在那裏我將返回所有條目,其中屬性=什麼的,但只能從ID的數組中。沒有一個ID

回答

3
Model.where('id in (?)', array_of_ids).where(attribute: "something") 
+0

找不到模型。但是,除去.find()將返回正確的數組。 – aperture

+0

也許這樣? –

+1

Model.where(「id in(?)and attribute =?」,array_of_ids,「something」)似乎有效。 – aperture

4
Model.where id: array_of_ids, attribute: 'something'