Fix adding items without a position (#38368)

This commit is contained in:
David Roetzel
2026-03-24 15:43:50 +01:00
committed by GitHub
parent 4559e4ed1a
commit 7788281759
3 changed files with 25 additions and 8 deletions

View File

@@ -62,7 +62,7 @@ class CollectionItem < ApplicationRecord
private
def set_position
return if position_changed?
return if position.present? && position_changed?
self.position = self.class.where(collection_id:).maximum(:position).to_i + 1
end