GORM Playground Link

https://github.com/go-gorm/playground/pull/637

Description

When embedding structure with embeddedPrefix gorm takes network_id as a foreign key. Seems that this is based on the ordering of the fields. If I put ID after the Network the following going to work fine:

type Account struct {
    Network Network `gorm:"embedded;embeddedPrefix:network_"`
    Peers   []Peer  `json:"-" gorm:"foreignKey:AccountID;references:ID"`
    ID      string  `gorm:"primaryKey"`
}