This Code pulls records where foobar is Nil
Model.where(user_id: 14, foobar: nil)
How can I use the same Syntax and get NOT nil?
Something like:
Model.where(user_id: 14, foobar: !nil)
Rails 4:
Model.where(user_id: 14).where().not(foobar: nil)
Rails 3 - Rails where condition using NOT NULL
Model.where(user_id: 14).where("foobar IS NOT NULL")
Model.where("user_id = ? AND foobar IS NOT ?", 14, nil)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With