Active Record validations support passing false
(for example, validates presence: false
) for a long ago (Don't enable validations when passing false hash values to ActiveMode… · rails/rails@b3ccd7b · GitHub).
It was originally intended to mean that when we use validates presence: false
we mean that don’t use this validation. But it sounds to me more like “validate that it is not present (aka absent)”.
So my colleague just yet implemented a feature using this presence: false
thinking that it will act like absence: true
.
I haven’t ever seen usage of this style, so not sure how it is currently useful. But this can lead to confusion and bugs.
What do people think about deprecating passing false
/nil
for now and raising for such values in the future?