diff --git a/embedded_struct_test.go b/embedded_struct_test.go index 17405b74..74997f13 100644 --- a/embedded_struct_test.go +++ b/embedded_struct_test.go @@ -39,4 +39,10 @@ func TestSaveAndQueryEmbeddedStruct(t *testing.T) { if DB.NewScope(&HNPost{}).PrimaryKeyField() == nil { t.Errorf("primary key with embedded struct should works") } + + for _, field := range DB.NewScope(&HNPost{}).Fields() { + if field.Name == "BasePost" { + t.Errorf("scope Fields should not contain embedded struct") + } + } } diff --git a/model_struct.go b/model_struct.go index d64b93c7..ed299e85 100644 --- a/model_struct.go +++ b/model_struct.go @@ -237,7 +237,7 @@ func (scope *Scope) GetModelStruct(noRelationship ...bool) *ModelStruct { modelStruct.PrimaryKeyField = f } } - break + continue } else { belongsToForeignKey := foreignKey if belongsToForeignKey == "" {