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.

Make associations respect store_full_sti_class

#6504

Currently when doing an association preload, it will respect store_full_sti_class and use sti_name for the class it is loading.

However, all of the association code that actually sets the value of these columns uses base_class.name rather than sti_name.

This means association preloading won't work on polymorphic associations if you have store_full_sti_class disabled.

This patch creates a polymorphic_name class method that just calls base_class.sti_name and then uses that in both the association preload code, as well as when the _type column gets set in the association code.

Test is included.

Reported by Joseph Palermo · March 2nd, 2011 @ 09:41 AM

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Joseph Palermo
    Joseph Palermo

    Looking closer, I see a lot of calls to "constantize" in the associations, rather than looking up the sti_class_name. Is store_full_sti_class supposed to apply to polymorphic type columns, or just to sti type columns?

    March 11th, 2011 @ 04:42 PM