Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4166 from nashby/range-min-max

use Range#min and Range#max to reduce extra statement
  • Loading branch information...
commit cf0fd053cd197250abaf693adcdbf9d12f24e350 2 parents 7a2a661 + ee2095e
Jeremy Kemper jeremy authored
Showing with 1 addition and 2 deletions.
  1. +1 −2  activemodel/lib/active_model/validations/length.rb
3  activemodel/lib/active_model/validations/length.rb
View
@@ -13,8 +13,7 @@ class LengthValidator < EachValidator
def initialize(options)
if range = (options.delete(:in) || options.delete(:within))
raise ArgumentError, ":in and :within must be a Range" unless range.is_a?(Range)
- options[:minimum], options[:maximum] = range.begin, range.end
- options[:maximum] -= 1 if range.exclude_end?
+ options[:minimum], options[:maximum] = range.min, range.max
end
super
Please sign in to comment.
Something went wrong with that request. Please try again.