From 6f64b8610da6d5214e9197ed3c1bf8ecf8983c89 Mon Sep 17 00:00:00 2001 From: Kyle Spraggs Date: Tue, 1 Aug 2017 18:05:11 -0500 Subject: [PATCH] Update callback_query_preload.go (#1553) --- callback_query_preload.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/callback_query_preload.go b/callback_query_preload.go index fff252c9..21ab22ce 100644 --- a/callback_query_preload.go +++ b/callback_query_preload.go @@ -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