I have an array column in postgres and I want to find all the records where this column is either nil
or []
. I can search one or the other fine but trying both fails.
This is what I attempted
Model.where(column: [nil, []])
But I get the error
ActiveRecord::StatementInvalid (PG::InvalidTextRepresentation: ERROR: malformed array literal: "{NULL,{}}")
DETAIL: Unexpected "{" character.
'{}'
. That said:Model.where(column: [nil, "'{}'"])
. – Chiaroscuro{NULL, '{}'}
, no? – Betteann