diff --git a/lib/simple_form/inputs/numeric_input.rb b/lib/simple_form/inputs/numeric_input.rb index a7537e27..44c19b7e 100644 --- a/lib/simple_form/inputs/numeric_input.rb +++ b/lib/simple_form/inputs/numeric_input.rb @@ -4,10 +4,12 @@ module SimpleForm enable :placeholder def input - input_html_options[:type] ||= "number" if SimpleForm.html5 input_html_options[:size] ||= nil - input_html_options[:step] ||= integer? ? 1 : "any" if SimpleForm.html5 - infer_attributes_from_validations! if SimpleForm.html5 + if SimpleForm.html5 + input_html_options[:type] ||= "number" + input_html_options[:step] ||= integer? ? 1 : "any" + infer_attributes_from_validations! + end @builder.text_field(attribute_name, input_html_options) end @@ -52,9 +54,13 @@ module SimpleForm end def evaluate_validator_option(option) - return option if option.is_a?(Numeric) - return object.send(option) if option.is_a?(Symbol) - return option.call(object) if option.respond_to?(:call) + if option.is_a?(Numeric) + option + elsif option.is_a?(Symbol) + object.send(option) + elsif option.respond_to?(:call) + option.call(object) + end end end end