EagerPreload only loading last association when using long association paths #626
Labels
f: associations
the associations feature in pop
s: triage
Some tests need to be run to confirm the issue
Milestone
Description
EagerPreload
does not seem to be loading all associations in 3+ level association paths where the first 2 levels are the same. Here's an example using the test model structs in pop_test.go:In this case, only the
Book.Taxi.Address
struct is populated. TheBook.Taxi.Driver
struct will have zero values (or be nil if a pointer field).If I change the above to an
Eager
call, things seem to work fine.If I shorten the paths to something smaller like below (but still use
EagerPreload
), it works fine as well:Steps to Reproduce the Problem
I made a test case that demonstrates the issue in a branch on my fork: master...reggieriser:preload-third-level-test
Expected Behavior
I would expect identical Eager and EagerPreload calls to be interchangeable with no difference in the resulting structs' values.
Actual Behavior
An association is not being loaded with EagerPreload
Info
Mac OS 10.15.7, Pop 5.3.3, not using Pop through Buffalo
The text was updated successfully, but these errors were encountered: