Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

fix to eager loading on polymorphic associations

#1554

We need to be sure to invoke the preload_XXX_associations method on the proper class, otherwise loading polymorphic associations will not work properly. It breaks on polymorphic associations because the polymorphic foreign key uses the local class as the name to use in the where clause (e.g. ['WHERE association_type = ?', class.name]).

Reported by acechase · December 10th, 2008 @ 09:39 PM

State: stale
Milestone: none
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: none

Activity

  1. Frederick Cheung
  2. acechase
    acechase

    It's a similar problem. In #546 Error in AR::AssociationPreload::ClassMethods#preload_associations when recor... the problem was that the records were not being grouped by class at all. Now, records are being grouped by class appropriately, but the #send that's happening after grouping is using the class the module is being included in, rather than the class the records are from.

    December 10th, 2008 @ 11:30 PM

  3. Jeremy Kemper
    Jeremy Kemper
    • Assigned user set to Jeremy Kemper
    • State changed from new to open
    • Milestone cleared.

    December 11th, 2008 @ 01:37 AM

  4. Jeremy Kemper
    Jeremy Kemper

    Nice catch. Needs a test case :)

    December 11th, 2008 @ 01:49 AM

  5. Jeremy Kemper
    Jeremy Kemper
    • State changed from open to stale

    January 10th, 2009 @ 08:06 PM