Stupid question maybe, but it drive me insane right now. Why
User.where(:created_at => 1.day.ago..Time.now).count
(0.8ms) SELECT COUNT(*) FROM "users" WHERE ("users"."created_at" BETWEEN '2012-11-06 17:58:22.443552' AND '2012-11-07 17:58:22.443809')
=> 2
And
User.where(:created_at => 1.day.ago.to_date..Time.now.to_date).count
(0.6ms) SELECT COUNT(*) FROM "users" WHERE ("users"."created_at" BETWEEN '2012-11-06' AND '2012-11-07')
=> 0
Give me a different result?
I know that without the time (with .to_date so) it should take midnight for the beginning and the end of the day. This is what I want, but for some obscure reasons, it show me 0, but I've created 2 users like 10 minutes ago....