Find records with a Range condition

You can find ActiveRecord models by using a Range Show archive.org snapshot as its conditions:

User.scoped(:conditions => { :id => 3..5 })

This will generate the following query:

SELECT * FROM `users` WHERE (`users`.`id` BETWEEN 3 AND 5)

This also means that all your scopes that take an array of allowed values and use condition hashes, automagically work for Ranges, too.

Henning Koch