Today I have needed to ask an SQLite DB to get some records with a field set to true, and all my first attempts to do it have been failed. Finally I have achieved it, and I would like to share this little achievement 🙂
NOT working:
Model.find(:all, :conditions => 'field = true')
NOT working:
Model.find(:all, :conditions => 'field = "true"')
NOT working:
Model.find(:all, :conditions => 'field = 1')
NOT working:
Model.find(:all, :conditions => 'field = "1"')
and finally working:
Model.find(:all, :conditions => 'field = "t"')
The solution has consisted on looking at DB level, which is the real data stored on it. Cheers 🙂