SELECT "flights".* FROM "flights" WHERE ("flights"."arrival_airport_id"
= 1) AND ("flights"."departure_datetime" >= '2011-01-07 17:21:56.932566'
AND "flights"."departure_datetime" < '2011-01-08 17:21:56.932568')
SELECT "flights".* FROM "flights" WHERE ("flights"."arrival_airport_id"
= 1) AND ("flights"."departure_datetime" >= '2011-01-07 17:21:56.932566'
AND "flights"."departure_datetime" < '2011-01-08 17:21:56.932568')
Oops, The above statements are actually correct but the resulting SQL
show here was incorrect. Should have been:
SELECT "flights".* FROM "flights" WHERE ("flights"."arrival_airport_id"
= 1) AND ("flights"."departure_datetime" >= '2011-01-07' AND
"flights"."departure_datetime" < '2011-01-08')
I think the above would only be correct if the OP is operating in UTC,
generally he should make @date the UTC time for the start of the local
day as the datetimes in the db will be in utc.
Thanks very much for all of the answers.
I went with :departure_datetime => @date...(@date + 1.day) as this was
exactly what I was after.
Thanks also for highlighting the difference between Rails 2 and Rails 3.
I look forward to giving Rails 3 a try.
Best,
Jim