From 24d527670b0d64a094c915522cad3f612eb02fed Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Fri, 7 Mar 2014 19:08:33 +0800 Subject: [PATCH] Use the same database for Related --- scope_private.go | 1 + 1 file changed, 1 insertion(+) diff --git a/scope_private.go b/scope_private.go index dae943e8..7212af2b 100644 --- a/scope_private.go +++ b/scope_private.go @@ -396,6 +396,7 @@ func (scope *Scope) typeName() string { func (scope *Scope) related(value interface{}, foreignKeys ...string) *Scope { toScope := scope.New(value) + toScope.db = scope.db for _, foreignKey := range append(foreignKeys, toScope.typeName()+"Id", scope.typeName()+"Id") { if foreignValue, ok := scope.FieldByName(foreignKey); ok {