@@ -12,42 +12,42 @@ def form_for_with_auto_html5_validation_option(record, options = {}, &proc)
1212 alias_method_chain :form_for , :auto_html5_validation_option
1313 end
1414
15- class InstanceTag
16- def to_input_field_tag_with_html5_attributes ( field_type , options = { } )
17- if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
18- options [ "required" ] ||= object . class . attribute_required? ( method_name )
19- options [ "maxlength" ] ||= object . class . attribute_maxlength ( method_name )
20- options [ "max" ] ||= object . class . attribute_max ( method_name )
21- options [ "min" ] ||= object . class . attribute_min ( method_name )
22- end
23- to_input_field_tag_without_html5_attributes field_type , options
15+ class InstanceTag
16+ def to_input_field_tag_with_html5_attributes ( field_type , options = { } )
17+ if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
18+ options [ "required" ] ||= object . class . attribute_required? ( method_name )
19+ options [ "maxlength" ] ||= object . class . attribute_maxlength ( method_name )
20+ options [ "max" ] ||= object . class . attribute_max ( method_name )
21+ options [ "min" ] ||= object . class . attribute_min ( method_name )
2422 end
25- alias_method_chain :to_input_field_tag , :html5_attributes
23+ to_input_field_tag_without_html5_attributes field_type , options
24+ end
25+ alias_method_chain :to_input_field_tag , :html5_attributes
2626
27- def to_text_area_tag_with_html5_attributes ( options = { } )
28- if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
29- options [ "required" ] ||= object . class . attribute_required? ( method_name )
30- options [ "maxlength" ] ||= object . class . attribute_maxlength ( method_name )
31- end
32- to_text_area_tag_without_html5_attributes options
27+ def to_text_area_tag_with_html5_attributes ( options = { } )
28+ if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
29+ options [ "required" ] ||= object . class . attribute_required? ( method_name )
30+ options [ "maxlength" ] ||= object . class . attribute_maxlength ( method_name )
3331 end
34- alias_method_chain :to_text_area_tag , :html5_attributes
32+ to_text_area_tag_without_html5_attributes options
33+ end
34+ alias_method_chain :to_text_area_tag , :html5_attributes
3535
36- def to_radio_button_tag_with_html5_attributes ( tag_value , options = { } )
37- if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
38- options [ "required" ] ||= object . class . attribute_required? ( method_name )
39- end
40- to_radio_button_tag_without_html5_attributes tag_value , options
36+ def to_radio_button_tag_with_html5_attributes ( tag_value , options = { } )
37+ if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
38+ options [ "required" ] ||= object . class . attribute_required? ( method_name )
4139 end
42- alias_method_chain :to_radio_button_tag , :html5_attributes
40+ to_radio_button_tag_without_html5_attributes tag_value , options
41+ end
42+ alias_method_chain :to_radio_button_tag , :html5_attributes
4343
44- def to_check_box_tag_with_html5_attributes ( options = { } , checked_value = "1" , unchecked_value = "0" )
45- if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
46- options [ "required" ] ||= object . class . attribute_required? ( method_name )
47- end
48- to_check_box_tag_without_html5_attributes options , checked_value , unchecked_value
44+ def to_check_box_tag_with_html5_attributes ( options = { } , checked_value = "1" , unchecked_value = "0" )
45+ if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
46+ options [ "required" ] ||= object . class . attribute_required? ( method_name )
4947 end
50- alias_method_chain :to_check_box_tag , :html5_attributes
48+ to_check_box_tag_without_html5_attributes options , checked_value , unchecked_value
5149 end
50+ alias_method_chain :to_check_box_tag , :html5_attributes
51+ end
5252 end
5353end
0 commit comments