rails/rails — pull request #17811 by mrnugget (2014-11-28 13:07:34+00:00)
Title: Adds preloaded_records method to NullPreloader - fixes #16070

This fixes a regression where preloading association throws an exception if one of the associations in the preloading hash doesn't exist for one record reported in #16070.

I experienced the same issue after upgrading to 4.1 from 4.0.

So I wrote up this patch. I don't know if this fix is correct. But my reasoning for adding `preloaded_records` to `NullPreloader` to return an empty array is this: every preloader has the `preloaded_records` attributes, which is initialized to an empty array. In order to for the NullPreloader to work as a preloader it needs this method.

If this solution is not correct, please tell me! I'll try to see what I can do. Any hints and ideas are appreciated! If nothing else, I at least have a test case with which to reproduce the error reported in #16070.