diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2016-06-15 18:22:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-15 18:22:34 -0400 |
commit | 7980b31bc6dd123a0635f470998362a602b66e25 (patch) | |
tree | 84c36d7b70ca3aabb66e2957b54d311ebc57eeae /activerecord/lib/active_record/relation | |
parent | 61a7239e405982e78de15bd86583514248e6f525 (diff) | |
parent | 1cf467b7a31749ccb3fc2a8ac89c5218c95e7d70 (diff) | |
download | rails-7980b31bc6dd123a0635f470998362a602b66e25.tar.gz rails-7980b31bc6dd123a0635f470998362a602b66e25.tar.bz2 rails-7980b31bc6dd123a0635f470998362a602b66e25.zip |
Merge pull request #25271 from kamipo/prevent_range_error_for_exists
Prevent `RangeError` for `FinderMethods#exists?`
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 882605de31..d255cad91b 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -333,6 +333,8 @@ module ActiveRecord end connection.select_value(relation, "#{name} Exists", relation.bound_attributes) ? true : false + rescue RangeError + false end # This method is called whenever no records are found with either a single @@ -571,7 +573,7 @@ module ActiveRecord # e.g., reverse_order.offset(index-1).first end end - + private def find_nth_with_limit_and_offset(index, limit, offset:) # :nodoc: |