Skip to content

Instantly share code, notes, and snippets.

@timharding
Created August 11, 2010 05:33
Show Gist options
  • Save timharding/518527 to your computer and use it in GitHub Desktop.
Save timharding/518527 to your computer and use it in GitHub Desktop.
User.find(:all, :conditions => {:created_at => 2.days.ago..1.day.ago})
# =>
# User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."created_at" BETWEEN '2010-08-09 05:31:57' AND '2010-08-10 05:31:57')
User.find(:all, :conditions => {:created_at => 2.days.ago...1.day.ago})
# =>
# User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."created_at" >= '2010-08-09 05:36:19' AND "users"."created_at" < '2010-08-10 05:36:19')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment