Sign in through GitHub

RailsCasts Pro episodes are now free!

Learn more or hide this

Optimistic Locking (revised)

#59 Optimistic Locking (revised)

Aug 04, 2012 | 8 minutes | Active Record
There is a chance one user will unintentionally override someone else's changes if they update a record near the same time. One solution is to use optimistic locking. The updated_at column can also be used for this as shown.
  • Download:
  • source codeProject Files in Zip (97.2 KB)
  • mp4Full Size H.264 Video (15.4 MB)
  • m4vSmaller H.264 Video (8.71 MB)
  • webmFull Size VP8 Video (11.4 MB)
  • ogvFull Size Theora Video (18.6 MB)