Update callback_query_preload.go (#1553)

This commit is contained in:
Kyle Spraggs 2017-08-01 18:05:11 -05:00 committed by Jinzhu
parent 35fb16eeba
commit 6f64b8610d
1 changed files with 6 additions and 1 deletions

View File

@ -289,7 +289,12 @@ 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()).Model(newScope.Value).Select("*") preloadDB = preloadDB.Table(newScope.TableName()).Model(newScope.Value)
if len(preloadDB.search.selects) == 0 {
preloadDB = preloadDB.Select("*")
}
preloadDB = joinTableHandler.JoinWith(joinTableHandler, preloadDB, scope.Value) preloadDB = joinTableHandler.JoinWith(joinTableHandler, preloadDB, scope.Value)
// preload inline conditions // preload inline conditions