Skip to content
Browse files

incorporated feedback from rafaelfranca

  • Loading branch information...
1 parent 524b595 commit 51a849744cdffb61a257d0ce42c66a310577c2aa @srbartlett srbartlett committed Jul 21, 2011
Showing with 2 additions and 3 deletions.
  1. +2 −3 lib/simple_form/inputs/string_input.rb
View
5 lib/simple_form/inputs/string_input.rb
@@ -8,8 +8,7 @@ class StringInput < Base
def input
input_html_options[:size] ||= [limit, SimpleForm.default_input_size].compact.min
- preferred_max_length = maximum_length_from_validation
- input_html_options[:maxlength] ||= preferred_max_length if preferred_max_length
+ input_html_options[:maxlength] ||= maximum_length_from_validation
input_html_options[:maxlength] ||= limit if limit && SimpleForm.html5
if password? || SimpleForm.html5
input_html_options[:type] ||= input_type unless string?
@@ -43,7 +42,7 @@ def maximum_length_from_validation
return unless has_validators?
length_validator = find_length_validator or return
- length_validator.options[:maximum] if length_validator.options.key? :maximum
+ length_validator.options[:maximum]
end
def find_length_validator

0 comments on commit 51a8497

Please sign in to comment.
Something went wrong with that request. Please try again.