From 5937b9eab5f7fb9c91da7340a24d2d689ef8d6e5 Mon Sep 17 00:00:00 2001 From: Hein Date: Thu, 18 Dec 2025 12:14:39 +0200 Subject: [PATCH] Fixed the double table on update --- pkg/restheadspec/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/restheadspec/handler.go b/pkg/restheadspec/handler.go index 9abb074..8d242ce 100644 --- a/pkg/restheadspec/handler.go +++ b/pkg/restheadspec/handler.go @@ -1247,7 +1247,7 @@ func (h *Handler) handleUpdate(ctx context.Context, w common.ResponseWriter, id } // Create update query using Model() to preserve custom types and driver.Valuer interfaces - query := tx.NewUpdate().Model(modelInstance).Table(tableName) + query := tx.NewUpdate().Model(modelInstance) query = query.Where(fmt.Sprintf("%s = ?", common.QuoteIdent(pkName)), targetID) // Execute BeforeScan hooks - pass query chain so hooks can modify it