aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type/decimal_without_scale.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-10-31 11:23:24 -0600
committerSean Griffin <sean@thoughtbot.com>2014-10-31 12:15:36 -0600
commite62fff40edde10bd04bbb91ce242f4a7f7ea64a8 (patch)
treef984582034b23691663a54fa978d5cbf4d8e403e /activerecord/lib/active_record/type/decimal_without_scale.rb
parent9b9f0197b7e645ae5b05a5581ba82f32f0971183 (diff)
downloadrails-e62fff40edde10bd04bbb91ce242f4a7f7ea64a8.tar.gz
rails-e62fff40edde10bd04bbb91ce242f4a7f7ea64a8.tar.bz2
rails-e62fff40edde10bd04bbb91ce242f4a7f7ea64a8.zip
Treat strings greater than int max value as out of range
Sufficiently large integers cause `find` and `find_by` to raise `StatementInvalid` instead of `RecordNotFound` or just returning `nil`. Given that we can't cast to `nil` for `Integer` like we would with junk data for other types, we raise a `RangeError` instead, and rescue in places where it would be highly unexpected to get an exception from casting. Fixes #17380
Diffstat (limited to 'activerecord/lib/active_record/type/decimal_without_scale.rb')
-rw-r--r--activerecord/lib/active_record/type/decimal_without_scale.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/type/decimal_without_scale.rb b/activerecord/lib/active_record/type/decimal_without_scale.rb
index cabdcecdd7..ff5559e300 100644
--- a/activerecord/lib/active_record/type/decimal_without_scale.rb
+++ b/activerecord/lib/active_record/type/decimal_without_scale.rb
@@ -1,8 +1,8 @@
-require 'active_record/type/integer'
+require 'active_record/type/big_integer'
module ActiveRecord
module Type
- class DecimalWithoutScale < Integer # :nodoc:
+ class DecimalWithoutScale < BigInteger # :nodoc:
def type
:decimal
end