Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charliepark/53083 to your computer and use it in GitHub Desktop.
Save charliepark/53083 to your computer and use it in GitHub Desktop.
From Rails changeset 5876: http://dev.rubyonrails.org/changeset/5876
A range may be used in the hash to use the SQL BETWEEN operator:
Student.find(:all, :conditions => { :grade => 9..12 })
... so, presumably ...
User.find(:all, :conditions => { :created_at => '2009-01-01'..'2009-02-01' })
... compare with ...
User.find(:all, :conditions => { :created_at.month = 1, :created_at.year = 2009 })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment