pools: add more name validations.

These validations should never fail because normalize_name strips
leading/trailing underscores, consecutive underscores, and unicode
whitespace.
This commit is contained in:
evazion
2019-09-07 22:10:25 -05:00
parent 1852b821f8
commit 4fc1e16731

View File

@@ -325,6 +325,14 @@ class Pool < ApplicationRecord
errors[:name] << "cannot contain commas"
when /\*/
errors[:name] << "cannot contain asterisks"
when /\A_/
errors[:name] << "cannot begin with an underscore"
when /_\z/
errors[:name] << "cannot end with an underscore"
when /__/
errors[:name] << "cannot contain consecutive underscores"
when /[^[:graph:]]/
errors[:name] << "cannot contain non-printable characters"
when ""
errors[:name] << "cannot be blank"
when /\A[0-9]+\z/