Sha256: 0f23237eea72a1e744ac5e6b5df60ba0b2c2e61b809c3dd1941a9e7ae23ebeb3
Contents?: true
Size: 671 Bytes
Versions: 28
Compression:
Stored size: 671 Bytes
Contents
module CustomAttributes # This class is only to be extended by types that need length validation class Unbounded < FieldType def validate_single_value(custom_field, value, customizable = nil) errs = super value = value.to_s if custom_field.min_length && value.length < custom_field.min_length errs << ::I18n.t('activerecord.errors.messages.too_short', count: custom_field.min_length) end if custom_field.max_length && custom_field.max_length > 0 && value.length > custom_field.max_length errs << ::I18n.t('activerecord.errors.messages.too_long', count: custom_field.max_length) end errs end end end
Version data entries
28 entries across 28 versions & 1 rubygems