Your Question

When using Preload the behavior is extremely strange

db.Model(models.Member{}).Preload("Organization").Preload("Organization.PrimaryZone").Preload("Organization.SessionSetting").Where(&models.Member{ID: &id}).Find(&emp)

In this case, the Organization.PrimaryZone might yield no result. If this is the case, the entire &emp will not be populated. I haven't seen the issue in the documentation. Moreover, the most natural way of handling this would be to load everything but the association that doesn't exist.

models.Member{ID:(*uuid.UUID)(nil), OrganizationID:(*uuid.UUID)(nil), Organization:(*models.Organization)(nil), Email:(*string)(nil), FirstName:(*string)(nil), LastName:(*string)(nil), Role:(*string)(nil), Password:(*string)(nil), AccessToken:(*string)(nil), CreatedAt:<nil>, UpdatedAt:<nil>, LastEvent:(*models.Event)(nil)}

The document you expected this should be explained

https://gorm.io/docs/preload.html

Expected answer

I'd like to know if there's any option to load the original model and other associations skipping the failing association instead.

Comment From: Loschcode

That was a mistake on my end. The behavior is correct in GORM.