Veraticus/Dynamoid — pull request #118 by loganb (2013-05-28 22:48:48+00:00)
Title: Add optimistic locking support automatically for tables with a lock_version

This adds optimistic_locking in the same vein as ActiveRecord (http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html). If you define a column on your table called "lock_version", Dynamoid will automatically increment the column by 1 on every save. Additionally, it will add a conditional check on every save ensuring no other save() action incremented the lock_version with this process was working.

This will cause concurrent updates to a single row to raise an exception rather than silently clobber each other. Code using Dynamoid can trap these exceptions and retry the operation.