module Sequel::Plugins::OptimisticLockingBase::InstanceMethods
Public Instance Methods
Source
# File lib/sequel/plugins/optimistic_locking_base.rb 21 def before_destroy 22 lock_column_instance_filter 23 super 24 end
Add the lock column instance filter to the object before destroying it.
Calls superclass method
Source
# File lib/sequel/plugins/optimistic_locking_base.rb 27 def before_update 28 lock_column_instance_filter 29 super 30 end
Add the lock column instance filter to the object before updating it.
Calls superclass method
Private Instance Methods
Source
# File lib/sequel/plugins/optimistic_locking_base.rb 47 def _refresh(ds) 48 clear_instance_filters 49 super 50 end
Clear the instance filters when refreshing, so that attempting to refresh after a failed save removes the previous lock column filter (the new one will be added before updating).
Calls superclass method
Source
# File lib/sequel/plugins/optimistic_locking_base.rb 35 def lock_column_instance_filter 36 instance_filter(model.lock_column=>lock_column_instance_filter_value) 37 end
Add the lock column instance filter to the object.
Source
# File lib/sequel/plugins/optimistic_locking_base.rb 40 def lock_column_instance_filter_value 41 public_send(model.lock_column) 42 end
Use the current value of the lock column