How should I write a query to find records where a value is NaN?
> Person.where(age: NaN)
NameError: uninitialized constant NaN
You should do:
Person.where(age: Float::NAN)
Check this NAN .
If you don't necessarily need to get a AR collection as a result of selection, but will be ok with an array, you can do it like this:
Person.all.select{ |p| p.age.nan? }
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