I'm trying to select all records that are not null from my table using where method
MyModel.where(:some_id => !nil)
but it doesn't work, is there any other solution to do this?
You can do it using the Arel syntax (which has the bonus of being database independent):
MyModel.where(MyModel.arel_table['some_id'].not_eq(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