Questo è il modo giusto per farlo. Per trovare auto il cui motore è nil , ad esempio, usa:
# Cars that have a _nil_ engine.
Car.where(:engine => nil)
Se stai cercando di cercare l'assenza di un campo (anziché uno impostato su nil ), usa $exists predicato:
# Cars that lack an engine entirely.
Car.where(:engine.exists => false)
Nota che impostando un campo foo essere nil e privo di un campo chiamato foo sono due cose diverse.