First, thanks for this piece of work. It helps a lot in my project!

Your Question

I have 2 tables with many to many relation, say Users many2many Languages When I update an User, I would also like to update the association with Languages, but I don't need to upsert Languages itself, so I have to specify omit:

db.Model(&user).Omit("Languages.*").Association("Languages").Replace(&langs)

It works almost perfect. It's just that I have several places that may db.Save(&user). So each place I have to explicitly Omit("Languages").

Is there's alway to specify that a certain field is always omitted?

The document you expected this should be explained

I would expect some tag to do the thing: https://gorm.io/docs/models.html

Expected answer

Comment From: saeidee

You may try to use hooks and wrap your logic there. https://gorm.io/docs/hooks.html