Skip to content

Commit 6ad1b85

Browse files
committed
fix: keep many2many join inserts in current session
1 parent 08069c1 commit 6ad1b85

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

callbacks/associations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ func SaveAfterAssociations(create bool) func(db *gorm.DB) {
347347
}
348348

349349
if joins.Len() > 0 {
350-
db.AddError(db.Session(&gorm.Session{NewDB: true}).Clauses(clause.OnConflict{DoNothing: true}).Session(&gorm.Session{
350+
db.AddError(db.Session(&gorm.Session{}).Clauses(clause.OnConflict{DoNothing: true}).Session(&gorm.Session{
351351
SkipHooks: db.Statement.SkipHooks,
352352
DisableNestedTransaction: true,
353353
}).Create(joins.Interface()).Error)

0 commit comments

Comments
 (0)