Method: Content::Validators::NameFormat#validate_each
- Defined in:
- app/models/content/validators/name_format.rb
#validate_each(record, attribute, value) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/content/validators/name_format.rb', line 20 def validate_each(record, attribute, value) if value unless value =~ /\A[[:alnum:] _-]*\z/ record.errors[attribute] << N_("cannot contain characters other than alpha numerals, space, '_', '-'") end NoTrailingSpace.validate_trailing_space(record, attribute, value) NameFormat.validate_length(record, attribute, value) else record.errors[attribute] << N_("cannot be blank") end end |