Module: ActiveRecord::Locking::Optimistic::ClassMethods
- Defined in:
- lib/active_record/locking/optimistic.rb
Constant Summary collapse
- DEFAULT_LOCKING_COLUMN =
'lock_version'
Instance Method Summary collapse
-
#locking_column ⇒ Object
The version column used for optimistic locking.
-
#quoted_locking_column ⇒ Object
Quote the column name used for optimistic locking.
-
#reset_locking_column ⇒ Object
Reset the column used for optimistic locking back to the lock_version default.
-
#set_locking_column(value = nil, &block) ⇒ Object
Set the column to use for optimistic locking.
Instance Method Details
#locking_column ⇒ Object
The version column used for optimistic locking. Defaults to lock_version.
90 91 92 |
# File 'lib/active_record/locking/optimistic.rb', line 90 def locking_column reset_locking_column end |
#quoted_locking_column ⇒ Object
Quote the column name used for optimistic locking.
95 96 97 |
# File 'lib/active_record/locking/optimistic.rb', line 95 def quoted_locking_column connection.quote_column_name(locking_column) end |
#reset_locking_column ⇒ Object
Reset the column used for optimistic locking back to the lock_version default.
100 101 102 |
# File 'lib/active_record/locking/optimistic.rb', line 100 def reset_locking_column set_locking_column DEFAULT_LOCKING_COLUMN end |
#set_locking_column(value = nil, &block) ⇒ Object
Set the column to use for optimistic locking. Defaults to lock_version.
84 85 86 87 |
# File 'lib/active_record/locking/optimistic.rb', line 84 def set_locking_column(value = nil, &block) define_attr_method :locking_column, value, &block value end |