mirror of https://github.com/go-gorm/gorm.git
Include model value when preloading many2many relations to enable row query callbacks
This commit is contained in:
parent
18917d1f3e
commit
caa792644c
|
@ -262,7 +262,7 @@ func (scope *Scope) handleManyToManyPreload(field *Field, conditions []interface
|
||||||
|
|
||||||
// generate query with join table
|
// generate query with join table
|
||||||
newScope := scope.New(reflect.New(fieldType).Interface())
|
newScope := scope.New(reflect.New(fieldType).Interface())
|
||||||
preloadDB = preloadDB.Table(newScope.TableName()).Select("*")
|
preloadDB = preloadDB.Table(newScope.TableName()).Model(newScope.Value).Select("*")
|
||||||
preloadDB = joinTableHandler.JoinWith(joinTableHandler, preloadDB, scope.Value)
|
preloadDB = joinTableHandler.JoinWith(joinTableHandler, preloadDB, scope.Value)
|
||||||
|
|
||||||
// preload inline conditions
|
// preload inline conditions
|
||||||
|
|
Loading…
Reference in New Issue