Rails Form submit race condition?
I am thinking whether it is possible that multiple users submitting a form
causing data being overwritten. This is the flow of actions in the order
of time:
1. User 1 clicks on Edit, rails render the page that has <form> and has
value {A: 1, B: 2}
2. User 2 clicks on Edit, rails render another page that has <form> and
has value {A: 1, B: 2}
3. User 1 updates value A to 5 and clicks on Submit, passing to server {A:
5, B: 2}
4. Server updates to database to {A: 5, B: 2}
5. User 2 updates value B to 10 and clicks on Submit, passing to server
{A: 1, B: 10}
6. Server updates to database to {A: 1, B: 10}
Since User 2's browser had the old data. When B hit submit, the field A
being past in as 1. User 1's update being overwritten.
How do I solve this issue in rails?