Skip to content

Commit

Permalink
Update callback_query_preload.go (go-gorm#1553)
Browse files Browse the repository at this point in the history
  • Loading branch information
spiffyjr authored and jinzhu committed Aug 1, 2017
1 parent 35fb16e commit 6f64b86
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion callback_query_preload.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,12 @@ func (scope *Scope) handleManyToManyPreload(field *Field, conditions []interface

// generate query with join table
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)

// preload inline conditions
Expand Down

0 comments on commit 6f64b86

Please sign in to comment.