diff --git a/lib/name_validator.rb b/lib/name_validator.rb index d8a7527..6ffbb37 100644 --- a/lib/name_validator.rb +++ b/lib/name_validator.rb @@ -1,7 +1,7 @@ class NameValidator < ActiveModel::Validator def validate(record) - unless record.name =~ /^[a-zA-Z0-1\.-_ ]+$/ + unless record.name =~ /^[a-zA-Z0-9\.\-_ ]+$/ record.errors[:name] << "Can only contain numbers, letters, space, '.', '-' and '_'" end end end