From 49edce37f92b1dcad4b67b3eb35922e7cec88726 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 1 Jun 2016 04:00:05 +0900 Subject: Translate numeric value out of range to the specific exception Raise `ActiveRecord::RangeError` when values that executed are out of range. --- activerecord/lib/active_record/core.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/core.rb') diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 1fbe374ade..878d87638d 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -194,7 +194,7 @@ module ActiveRecord name, primary_key, id) end record - rescue RangeError + rescue ::RangeError raise RecordNotFound.new("Couldn't find #{name} with an out of range value for '#{primary_key}'", name, primary_key) end @@ -223,7 +223,7 @@ module ActiveRecord statement.execute(hash.values, self, connection).first rescue TypeError raise ActiveRecord::StatementInvalid - rescue RangeError + rescue ::RangeError nil end end -- cgit v1.2.3