aperture
aperture

Reputation: 2895

Find from a subset of ids

Something like Model.find(array_of_ids, :conditions => {:attribute => "something"})

Where I will be returned all entries where attribute = something, but only from within that array of ids.

Upvotes: 0

Views: 155

Answers (2)

Mori
Mori

Reputation: 27779

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

Upvotes: 4

Henrique Zambon
Henrique Zambon

Reputation: 1301

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

Upvotes: 3

Related Questions