Module: DataMapper::Lock::Optimistic::ClassMethods
- Defined in:
- lib/dm-lock/optimistic.rb
Instance Method Summary collapse
-
#lock_optimistic(options = {}) ⇒ Object
Provide optimistic locking support.
Instance Method Details
#lock_optimistic(options = {}) ⇒ Object
Provide optimistic locking support.
This method adds a property named :lock_version which is used to track alterations made, preventing multi-thread/process rece conditions while updating or destroying records.
63 64 65 |
# File 'lib/dm-lock/optimistic.rb', line 63 def lock_optimistic = {} property :lock_version, Integer, :nullable => true, :default => 0 end |