I fixed a bug in
ActiveRecord::AssociationPreload::preload_one_association. The bug is
relatively obvious if you're familiar with that preload code, here's
my lighthouse ticket with patch:
This can be a very difficult bug to detect because the code thinks it
has loaded the associations correctly, but the where clause in the
query is incorrect so the actual records that get associated will
either be absent or of the wrong polymorphic type.