How can I query for all records with an empty array, using the Postgres array data type?
create_table "users", force: :cascade do |t|
t.string "email", limit: 255, default: "",null: false
t.string "roles", default: [], array: true
end
I want to query for all records with an empty roles array.
Tried User.where("roles @> ?", '{}') but that did not work (returned 0 records).
nilor[]?