Hoe kan ik gebruikers dwingen om een aangepast veld in te vullen als het leeg is

To that specific question, assuming that an unanswered question will be NULL in the database, you can just replace where.not(value: [nil]) with where(value: nil).

You can also use where(value: [nil, ""]), which is equivalent to WHERE (something.value IS NULL OR something.value = "") in SQL, to search for an empty string or NULL. I’m not sure which it’s likely to be or if it’s likely to change (from NULL to “”) if a user submits an empty field.