aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2011-12-24 08:48:35 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2011-12-24 08:48:35 -0800
commitcf0fd053cd197250abaf693adcdbf9d12f24e350 (patch)
treeb5c7127b76e99c992ee1738dec3037d7378e9bde /activemodel/lib
parent7a2a661b834ec744d3bfb166f1afd546312b739e (diff)
parentee2095e10702c9415a842866f98e45875c39a1c2 (diff)
downloadrails-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.rb3
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