mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 04:17:23 +00:00
fix updating collection.
This commit is contained in:
@@ -42,11 +42,11 @@ func UpdateCollection(id uint, title string, article string, images []uint) erro
|
||||
Article: article,
|
||||
}
|
||||
|
||||
if err := tx.Model(collection).Where("id = ?", id).Updates(collection).Error; err != nil {
|
||||
if err := tx.Model(collection).Updates(collection).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := tx.Model(collection).Where("id = ?", id).Association("Images").Replace(images); err != nil {
|
||||
if err := tx.Model(collection).Association("Images").Replace(images); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user