Module: Html5Validators::ActionViewExtension
- Included in:
- ActionView::Helpers::Tags::Base
- Defined in:
- lib/html5_validators/action_view/form_helpers.rb,
lib/html5_validators/action_view/form_helpers_ruby1.rb
Defined Under Namespace
Modules: FormHelper, LengthValidator, NumericalityValidator, PresenceValidator
Instance Method Summary
collapse
Instance Method Details
#inject_maxlength_attribute ⇒ Object
10
11
12
13
14
15
|
# File 'lib/html5_validators/action_view/form_helpers_ruby1.rb', line 10
def inject_maxlength_attribute
if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false)
@options["maxlength"] ||= @options[:maxlength] || object.class.attribute_maxlength(@method_name)
@options["minlength"] ||= @options[:minlength] || object.class.attribute_minlength(@method_name)
end
end
|
#inject_numericality_attributes ⇒ Object
17
18
19
20
21
22
|
# File 'lib/html5_validators/action_view/form_helpers_ruby1.rb', line 17
def inject_numericality_attributes
if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false)
@options["max"] ||= @options["max"] || @options[:max] || object.class.attribute_max(@method_name)
@options["min"] ||= @options["min"] || @options[:min] || object.class.attribute_min(@method_name)
end
end
|
#inject_required_attribute ⇒ Object
4
5
6
7
8
|
# File 'lib/html5_validators/action_view/form_helpers_ruby1.rb', line 4
def inject_required_attribute
if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false)
@options["required"] ||= @options[:required] || object.class.attribute_required?(@method_name)
end
end
|