Fix get PrimaryKeyField with embedded struct

This commit is contained in:
Jinzhu 2015-02-11 18:10:59 +08:00
parent aac52fdcf8
commit 87b23edd3b
1 changed files with 1 additions and 1 deletions

View File

@ -107,7 +107,7 @@ func (scope *Scope) PrimaryKeyField() *Field {
if typ.Kind() == reflect.Ptr { if typ.Kind() == reflect.Ptr {
typ = typ.Elem() typ = typ.Elem()
} }
clone = scope.New(reflect.New(typ).Elem().Interface()) clone = scope.New(reflect.New(typ).Elem().Addr().Interface())
} }
for _, field := range clone.Fields() { for _, field := range clone.Fields() {