Ticket #9640: fix_dont_attempt_to_preload_when_association_returns_nil.diff
| File fix_dont_attempt_to_preload_when_association_returns_nil.diff, 0.7 kB (added by GMFlash, 3 months ago) |
|---|
-
activerecord/lib/active_record/association_preload.rb
old new 21 21 preload_associations(records, parent, preload_options) 22 22 reflection = reflections[parent] 23 23 parents = records.map {|record| record.send(reflection.name)}.flatten 24 unless parents.empty? 24 unless parents.empty? || parents.first.nil? 25 25 parents.first.class.preload_associations(parents, child) 26 26 end 27 27 end