ruby on rails - "Where" method with "not nil" checking -
how can check if variable not nil when use "where" method ?
i tried these on product model has borrower_id field, didn't worked :
> product.where("borrower_id.nil?") > product.where("borrower_id != nil") > product.where("borrower_id == !nil")
the way found 1 :
> product.where("borrower_id > 0")
but doesn't seem clean...
try
product.where('borrower_id not null')
Comments
Post a Comment