diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2011-12-24 08:48:35 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2011-12-24 08:48:35 -0800 |
commit | cf0fd053cd197250abaf693adcdbf9d12f24e350 (patch) | |
tree | b5c7127b76e99c992ee1738dec3037d7378e9bde /activemodel/lib | |
parent | 7a2a661b834ec744d3bfb166f1afd546312b739e (diff) | |
parent | ee2095e10702c9415a842866f98e45875c39a1c2 (diff) | |
download | rails-cf0fd053cd197250abaf693adcdbf9d12f24e350.tar.gz rails-cf0fd053cd197250abaf693adcdbf9d12f24e350.tar.bz2 rails-cf0fd053cd197250abaf693adcdbf9d12f24e350.zip |
Merge pull request #4166 from nashby/range-min-max
use Range#min and Range#max to reduce extra statement
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/validations/length.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb index 760b5271bf..f91fc3a750 100644 --- a/activemodel/lib/active_model/validations/length.rb +++ b/activemodel/lib/active_model/validations/length.rb @@ -13,8 +13,7 @@ module ActiveModel 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 |