diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-05-03 14:06:30 -0500 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-05-03 14:06:30 -0500 |
commit | 83a8682c1d10306a5e73cfb9c3f28172ed48427a (patch) | |
tree | e4b0b1b7f82e5a6969ecd630b42e8146916bf9f3 /activemodel/lib | |
parent | ac8d0d76cb72bd0542405cfb73552a699f2bc0ef (diff) | |
parent | 17141481d99f1ae6d229cd5330b249f101abd116 (diff) | |
download | rails-83a8682c1d10306a5e73cfb9c3f28172ed48427a.tar.gz rails-83a8682c1d10306a5e73cfb9c3f28172ed48427a.tar.bz2 rails-83a8682c1d10306a5e73cfb9c3f28172ed48427a.zip |
Merge pull request #24835 from christianblais/activemodel/rangeerror
Change RangeError to a more specific ActiveModel::RangeError
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model.rb | 1 | ||||
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 4 | ||||
-rw-r--r-- | activemodel/lib/active_model/type/integer.rb | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/activemodel/lib/active_model.rb b/activemodel/lib/active_model.rb index b95c174d6e..7de259a60d 100644 --- a/activemodel/lib/active_model.rb +++ b/activemodel/lib/active_model.rb @@ -49,6 +49,7 @@ module ActiveModel eager_autoload do autoload :Errors + autoload :RangeError, 'active_model/errors' autoload :StrictValidationFailed, 'active_model/errors' autoload :UnknownAttributeError, 'active_model/errors' end diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index d106f65fa2..685e235730 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -526,6 +526,10 @@ module ActiveModel class StrictValidationFailed < StandardError end + # Raised when attribute values are out of range. + class RangeError < ::RangeError + end + # Raised when unknown attributes are supplied via mass assignment. class UnknownAttributeError < NoMethodError attr_reader :record, :attribute diff --git a/activemodel/lib/active_model/type/integer.rb b/activemodel/lib/active_model/type/integer.rb index 2f73ede009..eea2280b22 100644 --- a/activemodel/lib/active_model/type/integer.rb +++ b/activemodel/lib/active_model/type/integer.rb @@ -46,7 +46,7 @@ module ActiveModel def ensure_in_range(value) unless range.cover?(value) - raise RangeError, "#{value} is out of range for #{self.class} with limit #{_limit}" + raise ActiveModel::RangeError, "#{value} is out of range for #{self.class} with limit #{_limit}" end end |