From a11ca2ff76d3e1b845282e784c3970b2ebaffd89 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 5 Apr 2019 11:13:12 +0900 Subject: [PATCH] `preloaded_records` no longer includes `nil` since #35496 --- activerecord/lib/active_record/associations/preloader.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/activerecord/lib/active_record/associations/preloader.rb b/activerecord/lib/active_record/associations/preloader.rb index c7cd87f9d4..6b57e5093a 100644 --- a/activerecord/lib/active_record/associations/preloader.rb +++ b/activerecord/lib/active_record/associations/preloader.rb @@ -150,7 +150,6 @@ module ActiveRecord def grouped_records(association, records, polymorphic_parent) h = {} records.each do |record| - next unless record reflection = record.class._reflect_on_association(association) next if polymorphic_parent && !reflection || !record.association(association).klass (h[reflection] ||= []) << record