Skip to content

Commit

Permalink
⚡ Room's BeforeUpdate hook
Browse files Browse the repository at this point in the history
  • Loading branch information
iChemy committed Dec 19, 2024
1 parent 1861685 commit 4281d32
Showing 1 changed file with 1 addition and 1 deletion.
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 {
return err
}
return nil
Expand Down

0 comments on commit 4281d32

Please sign in to comment.