Module: Babik::QuerySet::Lockable
- Included in:
- AbstractBase
- Defined in:
- lib/babik/queryset/mixins/lockable.rb
Overview
Lock functionality of QuerySet
Instance Method Summary collapse
-
#for_update! ⇒ Object
Lock the table for writes This must be inside a transaction.
-
#lock! ⇒ Object
Lock the table for writes This must be inside a transaction.
-
#lock? ⇒ Boolean
Check if there is a lock.
Instance Method Details
#for_update! ⇒ Object
Lock the table for writes This must be inside a transaction
10 11 12 13 |
# File 'lib/babik/queryset/mixins/lockable.rb', line 10 def for_update! @_lock_type = 'FOR UPDATE' self end |
#lock! ⇒ Object
Lock the table for writes This must be inside a transaction
18 19 20 |
# File 'lib/babik/queryset/mixins/lockable.rb', line 18 def lock! self.for_update! end |
#lock? ⇒ Boolean
Check if there is a lock
24 25 26 27 |
# File 'lib/babik/queryset/mixins/lockable.rb', line 24 def lock? return true if @_lock_type false end |