Ruby Activerecord IN clause
From §3.3.3 Subset Conditions of the Rails Guides:
If you want to find records using the
IN
expression you can pass an array to the conditions hash:Customer.where(orders_count: [1,3,5])
This code will generate SQL like this:
SELECT * FROM customers WHERE (customers.orders_count IN (1,3,5))
You can also use the arel syntax:
Client.where(Client.arel_table[:order_count].in([1,3,5]))
will generate the same SQL.