diff options
author | Vipul A M <vipulnsward@gmail.com> | 2016-05-01 02:44:52 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2016-05-01 02:44:52 +0530 |
commit | 7b37e3edaf25627b6db023be5a1f8bf9733aafdd (patch) | |
tree | 6e87b587017353bc2fe074c2fe4a727c23bf1f03 | |
parent | 9d1bf059c0a570f68b2394bfb383434a6b0d0a49 (diff) | |
download | rails-7b37e3edaf25627b6db023be5a1f8bf9733aafdd.tar.gz rails-7b37e3edaf25627b6db023be5a1f8bf9733aafdd.tar.bz2 rails-7b37e3edaf25627b6db023be5a1f8bf9733aafdd.zip |
Move comment up to the class, for both of the methods, and document on class level why we are doing this.
[ci skip]
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 1e37ffefc6..67b8efac66 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -184,9 +184,12 @@ module ActiveRecord end end + + # 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 LockingType < DelegateClass(Type::Value) # :nodoc: def deserialize(value) - # `nil` *should* be changed to 0 super.to_i end |