diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2016-12-10 06:21:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-10 06:21:55 -0500 |
commit | 753da21322a2701f8b2294da1c26df8a783436d5 (patch) | |
tree | f45d2818358562b4336d677e71541cc033411d73 /activerecord/lib | |
parent | 2e8dad6318f06d2b41be3b3dd50b8bb112d2d200 (diff) | |
parent | 0da4a08bdfea28a0cc881ca5831aadfcf8a3b7eb (diff) | |
download | rails-753da21322a2701f8b2294da1c26df8a783436d5.tar.gz rails-753da21322a2701f8b2294da1c26df8a783436d5.tar.bz2 rails-753da21322a2701f8b2294da1c26df8a783436d5.zip |
Merge pull request #25280 from kamipo/prevent_range_error_for_belongs_to_associations
Prevent `RangeError` for `belongs_to` associations
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/singular_association.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/singular_association.rb b/activerecord/lib/active_record/associations/singular_association.rb index 1953cc6a72..6d69f757eb 100644 --- a/activerecord/lib/active_record/associations/singular_association.rb +++ b/activerecord/lib/active_record/associations/singular_association.rb @@ -58,6 +58,8 @@ module ActiveRecord sc.execute(binds, klass, conn) do |record| set_inverse_instance record end.first + rescue RangeError + nil end def replace(record) |