Module: Html5Validators::ActionViewExtension::LengthValidator

Included in:
ActionView::Helpers::Tags::TextArea, ActionView::Helpers::Tags::TextField
Defined in:
lib/html5_validators/action_view/form_helpers.rb

Instance Method Summary collapse

Instance Method Details

#renderObject



37
38
39
40
41
42
43
# File 'lib/html5_validators/action_view/form_helpers.rb', line 37

def render
  if object.is_a?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false)
    @options["maxlength"] ||= @options[:maxlength] || object.attribute_maxlength(@method_name)
    @options["minlength"] ||= @options[:minlength] || object.attribute_minlength(@method_name)
  end
  super
end