I have a many2many structure similar to GORM\'s example:
// User has and belongs to many languages, use `user_languages` as join table
type User struct {
gor
I was having the same problem, If you want to just remove one of the associations this worked for me
c.DB.Model(&user).Association("Roles").Delete(&role)
I found a solution to this question, but not sure it's the best way to do this. I store the current languages, clear all the associations, then add back the languages, then save.
languages := user.Languages
DB.Model(&user).Association("Languages").Clear()
user.Languages = languages
Also, you can do this by using "replace"
DB.Model(&user).Association("Languages").Replace(user.Languages)