From cad0a428754eb0cd93ef5c6cdb062853872649dd Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Thu, 18 Jun 2015 15:39:21 +0800 Subject: [PATCH] Get correct quoted table name --- join_table_handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/join_table_handler.go b/join_table_handler.go index e589d6f5..27051cbd 100644 --- a/join_table_handler.go +++ b/join_table_handler.go @@ -151,7 +151,7 @@ func (s JoinTableHandler) JoinWith(db *DB, source interface{}) *DB { var values []interface{} if s.Source.ModelType == modelType { for _, foreignKey := range s.Destination.ForeignKeys { - destinationTableName := scope.New(reflect.New(s.Destination.ModelType).Interface()).QuotedTableName() + destinationTableName := db.NewScope(reflect.New(s.Destination.ModelType).Interface()).QuotedTableName() joinConditions = append(joinConditions, fmt.Sprintf("%v.%v = %v.%v", quotedTable, scope.Quote(foreignKey.DBName), destinationTableName, scope.Quote(foreignKey.AssociationDBName))) }