Closed cavis closed 4 months ago
I'd probably try rails optimistic locking
https://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html
Yep, that's the "add a column" option. Though I do wonder if you could just wire that into the updated_at epoch.
So for the case:
Now the episode is unpublished again, with the new title from 3. This kind of conflict could really happen on any objects/fields.
We should handle with optimistic locking... the changes in (3) should be rejected. Rails/ActiveRecord has some built-ins for this, if you add a column. Or DIY it with updated_at?
Then we have some decisions after (3). What error message does User B get? Are their changes still in the unsaved-form? Can they opt to overwrite User A by clicking save a second time?