Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for overriding struct when running associations #196

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mewis
Copy link
Contributor

@mewis mewis commented Sep 11, 2020

I came across an issue with gorm associations.
I'm not sure if this is new or based on some of the changes that have been going on with gorm

when calling something like

if err = db.Model(&ormObj).Association("Children").Replace(ormObj.Children).Error; err != nil {
  return nil, err
}

there is a bonus select at the end. this means what ever you were looking at updating is replaced by this select

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant