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

🔥 Db refactoring #577

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion infra/db/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model(r) みたいなことをしていると rAdminsnil になってしまうみたい.(その仕様が書かれているドキュメントを見つけられてないが...)

return err
}
return nil
Expand Down
Loading