You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On repositioning (insert_at, etc.) the position gets updated before updating the siblings positions, which conflicts with unique constraint on position column. Also validates_uniqueness_of :position conflicts.
The solution could be not trivial; one possibility could be using temporary negative positions while updating in order to avoid the conflicts.
The text was updated successfully, but these errors were encountered:
Very specific option (if supported by DB, like in Postgres) may be to create that constraint with 'deferrable initial deferred' option, and making it nullable. That way constraint check should be postponed till the transaction end, when all positions are unique.
Yes, this has been discussed in another issue. You're right in that it's non-trivial to accommodate. We'll certainly look into any PR's that attempt to solve it in a graceful way :)
On repositioning (
insert_at
, etc.) the position gets updated before updating the siblings positions, which conflicts with unique constraint on position column. Alsovalidates_uniqueness_of :position
conflicts.The solution could be not trivial; one possibility could be using temporary negative positions while updating in order to avoid the conflicts.
The text was updated successfully, but these errors were encountered: