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

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -