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

Hello,

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 SQL.

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.

Regards, Craig

wow. sweetness. thank you!