Module: Html5Validators::ActionViewExtension

Included in:
ActionView::Helpers::Tags::Base
Defined in:
lib/html5_validators/action_view/form_helpers.rb

Instance Method Summary collapse

Instance Method Details

#inject_maxlength_fieldObject



9
10
11
12
13
# File 'lib/html5_validators/action_view/form_helpers.rb', line 9

def inject_maxlength_field
  if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false)
    @options["maxlength"] ||= object.class.attribute_maxlength(@method_name)
  end
end

#inject_required_fieldObject



3
4
5
6
7
# File 'lib/html5_validators/action_view/form_helpers.rb', line 3

def inject_required_field
  if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false)
    @options["required"] ||= object.class.attribute_required?(@method_name)
  end
end