module DefraRuby::Validators::CanValidateLength

Private Instance Methods

value_is_not_too_long?(record, attribute, value, max_length) click to toggle source
# File lib/defra_ruby/validators/concerns/can_validate_length.rb, line 9
def value_is_not_too_long?(record, attribute, value, max_length)
  return true if value.length <= max_length

  add_validation_error(record, attribute, :too_long)
  false
end