diff options
author | Reuben Pereira <rpereira@gitlab.com> | 2019-07-31 06:54:03 +0000 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-07-31 06:54:03 +0000 |
commit | 5c7f2853dc5a8eca874108a0217a115090f29e9b (patch) | |
tree | 15e22a546814fa495fbb00ce1fdfbf2efa97a1d2 /app/validators | |
parent | 67ffe3ced0a704d78f528e5dc8ea4243e5e4a47f (diff) | |
download | gitlab-ce-5c7f2853dc5a8eca874108a0217a115090f29e9b.tar.gz |
Allow blank but not nil in validations
- The most common use case for qualified_domain_validator currently is
to allow blank ([]) but not allow nil. Modify the
qualified_domain_validator to support this use case.
Diffstat (limited to 'app/validators')
-rw-r--r-- | app/validators/qualified_domain_array_validator.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/validators/qualified_domain_array_validator.rb b/app/validators/qualified_domain_array_validator.rb index 986c146a9db..c3a79d21ac0 100644 --- a/app/validators/qualified_domain_array_validator.rb +++ b/app/validators/qualified_domain_array_validator.rb @@ -23,9 +23,9 @@ class QualifiedDomainArrayValidator < ActiveModel::EachValidator private def validate_value_present(record, attribute, value) - return unless value.blank? + return unless value.nil? - record.errors.add(attribute, _('entries cannot be blank')) + record.errors.add(attribute, _('entries cannot be nil')) end def validate_host_length(record, attribute, value) |