something strange with sqlite ?

I have an active record query (for my categories) that check for the date ( .where( ‘enddate > ?’, todaydate )).

Today’s date get’s wrapped in quotes, and it fails to produce any records, but it’s perfectly fine in postgres.

I think you will need to wrap todaydate in strftime for sqlite. Away from computer to check but google ‘date arithmetic sqlite’

Thanks, I’ll try that.

Hopefully it works for postgres and sqlite.

doubtful. They are very different. Any reason you can’t stick with one of them?

What exactly is "todaydate"? What's the column definition of "enddate"?

And are you sure you have identical records in both DBs you're testing this with?

Hi, I defined time like this —>

require ‘time’

todaydate = Time.new

todaydate = todaydate.year.to_s + “-” + todaydate.month.to_s + “-” + todaydate.day.to_s

and the column for enddate is a date type. It had worked previously, I just updated the dates in a populate rake file and stopped working (on the development env (sqlite)).

Thanks,

Joe

Aside from the potential problem of redefining the same variable, I'd avoid trying to compare a DB `date` with a String, but in this case --

Sqlite3 doesn't have a `date` type so you might want to spend a few minutes here: Datatypes In SQLite

HTH!