From 2a1d64c3e067bd1af99987157f9625a4605ed85e Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Wed, 24 Jun 2015 14:09:59 +0800 Subject: [PATCH] Return cloned db instance for AddForeignKey --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index ff7182bf..aba51fc4 100644 --- a/main.go +++ b/main.go @@ -434,7 +434,7 @@ Example: func (s *DB) AddForeignKey(field string, dest string, onDelete string, onUpdate string) *DB { scope := s.clone().NewScope(s.Value) scope.addForeignKey(field, dest, onDelete, onUpdate) - return s + return scope.db } func (s *DB) Association(column string) *Association {