NULL value in :conditions =>

Posted by Horace Ho on Stack Overflow See other posts from Stack Overflow or by Horace Ho
Published on 2010-05-27T04:22:36Z Indexed on 2010/05/27 5:01 UTC
Read the original article Hit count: 163

Filed under:
|
 Contract.all(:conditions => ['voided == ?', 0]).size
 => 364
 Contract.all(:conditions => ['voided != ?', 0]).size
 => 8
 Contract.all.size
 => 441

the 3 numbers does not added up (364 + 8 != 441). What's the proper way write the :conditions to count the rows which the voided column value is NULL or equal to zero?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about activerecord