diff --git a/infra/db/hooks.go b/infra/db/hooks.go index 3c7f6ff..6e174fd 100644 --- a/infra/db/hooks.go +++ b/infra/db/hooks.go @@ -180,7 +180,7 @@ func (r *Room) BeforeSave(tx *gorm.DB) (err error) { } func (r *Room) BeforeUpdate(tx *gorm.DB) (err error) { - if err := tx.Model(r).Association("Admins").Clear(); err != nil { + if err := tx.Model(&Room{ID: r.ID}).Association("Admins").Clear(); err != nil { return err } return nil