Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Pereira <rpereira@gitlab.com>2019-07-31 09:54:03 +0300
committerJames Lopez <james@gitlab.com>2019-07-31 09:54:03 +0300
commit5c7f2853dc5a8eca874108a0217a115090f29e9b (patch)
tree15e22a546814fa495fbb00ce1fdfbf2efa97a1d2 /app/validators
parent67ffe3ced0a704d78f528e5dc8ea4243e5e4a47f (diff)
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.rb4
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)