From 9f0657374bdfd7962bedeb4f380e969f3c5984f1 Mon Sep 17 00:00:00 2001 From: "valentin.daviot" Date: Mon, 5 Nov 2018 11:24:41 +0100 Subject: [PATCH] unsetting work properly --- shell.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell.go b/shell.go index 253414c..242014f 100644 --- a/shell.go +++ b/shell.go @@ -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 }