gitlab-org--gitlab-foss/app/validators/namespace_name_validator.rb

11 lines
337 B
Ruby
Raw Normal View History

2015-12-07 16:17:24 -05:00
# NamespaceNameValidator
#
# Custom validator for GitLab namespace name strings.
class NamespaceNameValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
unless value =~ Gitlab::Regex.namespace_name_regex
record.errors.add(attribute, Gitlab::Regex.namespace_name_regex_message)
end
end
end