unsetting work properly

This commit is contained in:
valentin.daviot 2018-11-05 11:24:41 +01:00 committed by Manfred Touron
parent 61b7f72e94
commit 9f0657374b
No known key found for this signature in database
GPG key ID: 6D4DED2EAB123456

View file

@ -926,8 +926,9 @@ GLOBAL OPTIONS:
// remove the hop
if c.Bool("unset-hop") {
var hopHost Host
db.Model(&host).Related(&hopHost, "HopID")
if err := model.Association("Hop").Delete(hopHost).Error; err != nil {
if err := model.Association("Hop").Clear().Error; err != nil {
tx.Rollback()
return err
}