Rails’ find_by_xxx and find_all_by_xxx methods accept arrays and ranges!

Use an array as the argument to a find_by_xxx method:

Appointment.find_by_date([ Date.today, Date.today + 1])

And the generated SQL:

SELECT * FROM appointments WHERE (appointments.’date’ IN (’2007-10-07′,’2007-10-08′)) LIMIT 1

Use a range as the argument to a find_all_by_xxx method:

Appointment.find_by_date((Date.today..Date.today + 1))

SELECT * FROM appointments WHERE (appointments.’date’ BETWEEN ‘2007-10-07′ AND ‘2007-10-08′) LIMIT 1

Both methods (find_by and find_all_by) accept both arrays [...]