mirror of https://github.com/go-gorm/gorm.git
Fix preloading all associations together with nested associations, close #4016
This commit is contained in:
parent
4267df02af
commit
6e3ac74b7e
|
@ -172,7 +172,7 @@ func Preload(db *gorm.DB) {
|
||||||
if name == clause.Associations {
|
if name == clause.Associations {
|
||||||
for _, rel := range db.Statement.Schema.Relationships.Relations {
|
for _, rel := range db.Statement.Schema.Relationships.Relations {
|
||||||
if rel.Schema == db.Statement.Schema {
|
if rel.Schema == db.Statement.Schema {
|
||||||
preloadMap[rel.Name] = nil
|
preloadMap[rel.Name] = map[string][]interface{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue