diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-21 21:09:05 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-25 20:14:56 +0900 |
commit | 1d8fad6f903d5065911bea3409c7a9082f47d3f8 (patch) | |
tree | 8504ca8cc3a484cd32d46f133d578b45b3bc0206 /activerecord/test/cases/dirty_test.rb | |
parent | 67e20d1d4854d834e9e43e56486d37cd98983f0d (diff) | |
download | rails-1d8fad6f903d5065911bea3409c7a9082f47d3f8.tar.gz rails-1d8fad6f903d5065911bea3409c7a9082f47d3f8.tar.bz2 rails-1d8fad6f903d5065911bea3409c7a9082f47d3f8.zip |
Ensure `update_all` series cares about optimistic locking
Incrementing the lock version invalidates any other process's optimistic
lock, which is the desired outcome: the record no longer looks the same
as it did when they loaded it.
Diffstat (limited to 'activerecord/test/cases/dirty_test.rb')
-rw-r--r-- | activerecord/test/cases/dirty_test.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index dfd74bfcb4..a2a501a794 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -352,7 +352,7 @@ class DirtyTest < ActiveRecord::TestCase Person.where(id: person.id).update_all(first_name: "baz") end - old_lock_version = person.lock_version + old_lock_version = person.lock_version + 1 with_partial_writes Person, true do assert_no_queries { 2.times { person.save! } } |