Rails Date After
Say you want records starting 30th May:
Then search for records that are >= 2011-05-30 00:00:00
:
some_date = Time.nowItem.where("created_at >= :date OR updated_at >= :date", date: some_date.tomorrow.beginning_of_day)
I think the problem is that the created_at and updated_at are datetime, so if you only pass a date it defaults the time to 00:00:00 and anything past that is obviously greater. So the records you are seeing are past that date since the hour is greater.
Take a look at your precision, you can either pass 1 more day, and I'll show anything above that day, even greater for a second, or simply pass the hour as 23:59:59.
Unfortunately SQL disagrees with you:
mysql> SELECT '2011-05-30 12:00:00' > '2011-05-30';+--------------------------------------+| '2011-05-30 12:00:00' > '2011-05-30' |+--------------------------------------+| 1 |+--------------------------------------+
And for comparing dates with datetimes, MySQL has this to say:
A DATE value is coerced to the DATETIME type by adding the time portion as '00:00:00'.