Allow customize join table's table in callback

This commit is contained in:
Jinzhu 2021-01-10 14:58:54 +08:00
parent f9131e309d
commit 7ebb320f3e
1 changed files with 1 additions and 1 deletions

View File

@ -49,7 +49,7 @@ func preload(db *gorm.DB, rels []*schema.Relationship, conds []interface{}) {
} }
joinResults := rel.JoinTable.MakeSlice().Elem() joinResults := rel.JoinTable.MakeSlice().Elem()
column, values := schema.ToQueryValues(rel.JoinTable.Table, joinForeignKeys, joinForeignValues) column, values := schema.ToQueryValues(clause.CurrentTable, joinForeignKeys, joinForeignValues)
db.AddError(tx.Where(clause.IN{Column: column, Values: values}).Find(joinResults.Addr().Interface()).Error) db.AddError(tx.Where(clause.IN{Column: column, Values: values}).Find(joinResults.Addr().Interface()).Error)
// convert join identity map to relation identity map // convert join identity map to relation identity map