aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2016-05-14 09:54:23 +0000
committerVijay Dev <vijaydev.cse@gmail.com>2016-05-14 09:54:23 +0000
commit83ecf3fe56f0c4b89cc5f2c5bdab6e0e7d26b7a1 (patch)
tree899a536f2c978f6349a48932a2da1c0cc8b84c4a /activerecord
parent4046ac7e88dfcd9089e602ad0d6196bc8efc46a6 (diff)
parent26e59e686c2553035ad3f7c50089b79c93d07f38 (diff)
downloadrails-83ecf3fe56f0c4b89cc5f2c5bdab6e0e7d26b7a1.tar.gz
rails-83ecf3fe56f0c4b89cc5f2c5bdab6e0e7d26b7a1.tar.bz2
rails-83ecf3fe56f0c4b89cc5f2c5bdab6e0e7d26b7a1.zip
Merge branch 'master' of github.com:rails/docrails
Conflicts: guides/source/configuring.md
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/locking/optimistic.rb5
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