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

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -