Select * from users where id in (2,5,8)


I’m trying to search for users in a set of ids:

select * from users where id in (2,5,8)

Is there a “RoR” way to do the above query without having to resort
to find_by_sql?

Or are there any plugins that allow this?

I am somewhat of a Ruby purist and don’t want to taint my code with

Thank you,
David :slight_smile:

User.find(2, 5, 8)

The find method on an ActiveRecord model searches by ID, and it
accepts one or many IDs.


wow. sweetness. thank you!

On May 13, 8:12 am, “Craig D.” [email protected]