Class: ActiveRecord::Locking::LockingType
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | activerecord/lib/active_record/locking/optimistic.rb |
Overview
In de/serialize we change nil to 0, so that we can allow passing nil values to lock_version, and not result in ::ActiveRecord::StaleObjectError during update record.
Class Method Summary
- .new(subtype) ⇒ LockingType constructor
Instance Method Summary
Constructor Details
.new(subtype) ⇒ LockingType
# File 'activerecord/lib/active_record/locking/optimistic.rb', line 214
def self.new(subtype) self === subtype ? subtype : super end
Instance Method Details
#deserialize(value)
[ GitHub ]# File 'activerecord/lib/active_record/locking/optimistic.rb', line 218
def deserialize(value) super.to_i end
#encode_with(coder)
[ GitHub ]# File 'activerecord/lib/active_record/locking/optimistic.rb', line 230
def encode_with(coder) coder["subtype"] = __getobj__ end
#init_with(coder)
[ GitHub ]# File 'activerecord/lib/active_record/locking/optimistic.rb', line 226
def init_with(coder) __setobj__(coder["subtype"]) end
#serialize(value)
[ GitHub ]# File 'activerecord/lib/active_record/locking/optimistic.rb', line 222
def serialize(value) super.to_i end