Merge branch 'cid-10' into bug_fix
This commit is contained in:
commit
8d332fac9d
@ -4,14 +4,14 @@ module Validators
|
|||||||
class Name < Base
|
class Name < Base
|
||||||
|
|
||||||
MAX_NAME_LEN = 200
|
MAX_NAME_LEN = 200
|
||||||
NAME_REGEX = /\A\w{1,#{MAX_NAME_LEN}}\z/
|
NAME_REGEX = /\A[\w\-]{1,#{MAX_NAME_LEN}}\z/
|
||||||
|
|
||||||
def valid?
|
def valid?
|
||||||
!NAME_REGEX.match(@value).nil?
|
!NAME_REGEX.match(@value).nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def message
|
def message
|
||||||
"Invalid value '#{@value}': it should contains symbols 'a-zA-Z0-9_' and length should be more then 1 and less or equals then #{MAX_NAME_LEN} symbols"
|
"Invalid value '#{@value}': it should contains symbols 'a-zA-Z0-9_-' and length should be more then 1 and less or equals then #{MAX_NAME_LEN} symbols"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user