aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/validations')
-rw-r--r--activemodel/lib/active_model/validations/length.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb
index a7af4f2b4d..ecae73a66e 100644
--- a/activemodel/lib/active_model/validations/length.rb
+++ b/activemodel/lib/active_model/validations/length.rb
@@ -41,13 +41,9 @@ module ActiveModel
CHECKS.each do |key, validity_check|
next unless check_value = options[key]
- valid_value = if key == :maximum
- value.nil? || value.size.send(validity_check, check_value)
- else
- value && value.size.send(validity_check, check_value)
- end
+ value ||= [] if key == :maximum
- next if valid_value
+ next if value && value.size.send(validity_check, check_value)
errors_options = options.except(*RESERVED_OPTIONS)
errors_options[:count] = check_value