I'm struggling with the conditions for date querying in the 'find' method on my ActiveRecord models running over an SQLite3 database. My model is as follows:
Day:
failure_day: date
failure_count: integer
When I attempt to query Days, I get the following (pseudo code only):
Query: Days.all
Result: [{failure_day: 2010-04-14, failure_count: 1}]
Query: Days.find(:first, :conditions=>'failure_day > 2010-02-01')
Result: {failure_day: 2010-04-14, failure_count: 1}
Query: Days.find(:first, :conditions=>'failure_day = 2010-04-14')
Result: nil
Query: Days.find(:first, :conditions=>'failure_day < 2010-05-05')
Result: nil
What I can't understand is why the last two queries return 'nil'. The first query (Days.all) proves that I have a record in my database. The second one correctly matches 'failure_day' against a date that is less than 'failure_day', but when trying equal or less than it doesn't work.
Any ideas?