binarylogic / searchlogic

Searchlogic provides object based searching, common named scopes, and other useful tools.
http://rdoc.info/projects/binarylogic/searchlogic
MIT License
1.39k stars 133 forks source link

searching boolean columns? #49

Closed punund closed 14 years ago

punund commented 14 years ago

What is the "right" way to search on boolean columns?

>>  Invite.code_equals('F0LzDetW')
=> [#<Invite id: 29, created_at: "2009-11-14 20:53:51", updated_at: "2009-11-14 20:53:51", code: "F0LzDetW", table: nil, item: 11, accepted: nil, email: "bot@........lv">]
>>  Invite.code_equals('F0LzDetW').accepted_equals(false)
=> []
>>  Invite.code_equals('F0LzDetW').accepted_equals(nil)
=> []
>>  Invite.code_equals('F0LzDetW').accepted_does_not_equal(false)
=> []
>>  Invite.code_equals('F0LzDetW').accepted_does_not_equal(nil)
=> []
>> 
ghost commented 14 years ago

Whats the resulting SQL of the calls? That should work fine. But the correct way is to just use Invite.accepted, not argument