DEV Community

Discussion on: Update jsonb Columns Using The Rails Active Record Native Methods

Collapse
danishsatkut profile image
Danish Aziz Satkut

Your code can result in a race condition when two request execute the above code at the same time. Hence, the tutorials use the jsonb_set, which performs the modification directly at DB level.

Collapse
heshiebee profile image
Heshie Brody Author

Good point. Wrote this when I was just starting out, should definitely revise this :)