Question

I'm trying to do something like...

self.where(active: true, latitude: !nil)

this doesn't work. I basically need something that queries for objects who HAVE a latitude property which has a value. Thanks!

Était-ce utile?

La solution

something like this also works

self.where("active = ? AND latitude IS NOT ?", true, nil)

OR

Rails 4 way

self.where(active: true).where().not(latitude: nil)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top