Class: NameFormatValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- NameFormatValidator
- Defined in:
- lib/ama_validators/name_format_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(object, attribute, value) ⇒ Object
2 3 4 5 6 |
# File 'lib/ama_validators/name_format_validator.rb', line 2 def validate_each(object, attribute, value) unless value =~ /\A[\sa-zA-ZÀàÂâÄäÈèÉéÊêËëÎîÏïÔôŒœÙùÛûÜüŸÿÇç,.'\-\)\(]+\z/ object.errors[attribute] << ([:message] || "We're sorry your name cannot contain any special characters") end end |