Commit ec7a8d8b authored by zauberstuhl's avatar zauberstuhl
Browse files

Update contact with ID greater then zero as well

closes #69
parent 51fc947a
......@@ -87,16 +87,16 @@ func (c *Contact) Update() error {
}
defer db.Close()
var dbContact Contact
sharing := c.Sharing
if c.ID <= 0 {
err = db.Where("user_id = ? AND person_id = ?",
c.UserID, c.PersonID).First(&dbContact).Error
c.UserID, c.PersonID).First(c).Error
if err != nil {
return err
}
}
return db.Model(&dbContact).Update("sharing", c.Sharing).Error
return db.Model(c).Update("sharing", sharing).Error
}
func (c *Contacts) FindByUserID(id uint) error {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment