Given a model User and a string array column device_ids, how can I query for all Users that have nulls as an element of this array column?
E.g., some of the users has invalid values for device_ids:
user.device_ids
=> [null, "XYZABCDEFGH"]
I tried querying as suggested in this answer...
User.where.not("(-1 = ANY(device_ids)) IS NULL")
... but I get this error:
ERROR: operator does not exist: integer = character varying
Is there any other ways to get all the users in a single query?