Booleans, :conditions and Sqlite

Howdy,

Names changed to protect the innocent…

I have a column, lets say ‘complete’ on a table, lets say ‘todos’.

I originally had that column as boolean (as its true/false)

I added an association to User… has_many :outstanding_todos which had
a :conditions => “complete = false”.

When I run this up it doesn’t work, and the reson it doesn’t work is
Sqlite (which I’m using for development) seems to set the value of a
false boolean column to ‘f’ (which I’m fairly sure mysql doesn’t do).

So I can change my :conditions, but then it’ll only work on sqlite,
right ?

Since it’s a string of raw sql, there doesn’t seem tobe a way to pass it
through the DB adapter layer to use the correct syntax for the current
DB.

I’ve ended up making it an integer using 0 and 1 as that seems portable.

Has anyone any other suggestions ?

Alan

Try :conditions => [“complete = ?”, false]

Fred