There is a canceled column in table record in our rails 3.1.4 app. Initially the canceled was created in Firefox SQLite manager as BOOL which is a default type provided by the software. With canceled = false in rails, the false was saved into the record table for col canceled. The problem is when query with Record.where("canceled = ?", false), the records with canceled as false were not selected because false is not interpreted as FALSE in sqlite3. In order to select all canceled = false, we have to do Record.where("canceled =? OR canceled =?", false, 'false').
After we manually changed the data type of canceled from BOOL to ‘boolean’ in SQLite manager, the Record.where("canceled =? ", false) can pick up the newly created record with canceled as f. In SQLite manager, those canceled value is represented as f which is interpreted as FALSE by rails.
How to fix the table record (with ‘false’ for canceled) so that Record.where("canceled =? ", false) will work? Thanks so much.
UPDATE: when query the table record in rails console, the canceled does not behave as a boolean (either true or false). All records with false in column canceled can not be picked up by either Record.where("canceled =?", true) or Record.where("canceled =?", false). But the .class returned for canceled is still FalseClass in rails console. Strange, isn’t it?
Edit:
Try this