def length_for_attribute(attribute, type)
      length_validator = find_validator(attribute, ActiveModel::Validations::LengthValidator)
      return unless length_validator

      length_validator.options[type]
    end
def length_for_attribute(attribute, type)
      length_validator = find_validator(attribute, ActiveModel::Validations::LengthValidator)
      return unless length_validator

      length_validator.options[type]
    end
Private: Tries to find a length validator in the form object.

 attribute - The attribute to look for the validations.
 type      - A Symbol for the type of length to fetch. Currently only :minimum & :maximum are supported.

 Returns an Integer or Nil.