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:
@@ -325,6 +325,14 @@ class Pool < ApplicationRecord
|
|||||||
errors[:name] << "cannot contain commas"
|
errors[:name] << "cannot contain commas"
|
||||||
when /\*/
|
when /\*/
|
||||||
errors[:name] << "cannot contain asterisks"
|
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 ""
|
when ""
|
||||||
errors[:name] << "cannot be blank"
|
errors[:name] << "cannot be blank"
|
||||||
when /\A[0-9]+\z/
|
when /\A[0-9]+\z/
|
||||||
|
|||||||
Reference in New Issue
Block a user