Method: NForm::Validations#validate_length_of
- Defined in:
- lib/nform/validations.rb
#validate_length_of(key, length) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/nform/validations.rb', line 39 def validate_length_of(key,length) val = send(key) if val && val.respond_to?(:length) && val.length >= length true else errors[key] = "#{key.to_s.humanize} must be at least #{length} characters long" false end end |