aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2016-09-17 08:54:35 -0400
committerGitHub <noreply@github.com>2016-09-17 08:54:35 -0400
commit2159a932335486d6e982bfb42ca297f42e0e42c0 (patch)
treef59392db833567ad37a1878f00edf45986faa583 /activerecord/lib/active_record/persistence.rb
parentb5ef59f234b821988d5afcfc8bcca9999892577e (diff)
parente835596ae882e748e452e52131c2a4244336660b (diff)
downloadrails-2159a932335486d6e982bfb42ca297f42e0e42c0.tar.gz
rails-2159a932335486d6e982bfb42ca297f42e0e42c0.tar.bz2
rails-2159a932335486d6e982bfb42ca297f42e0e42c0.zip
Merge pull request #26497 from koppen/26496-touch_with_optimistic_locking
Clear attribute changes after handling locking
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index a04ef2e263..978fb27cab 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -498,7 +498,6 @@ module ActiveRecord
changes[column] = write_attribute(column, time)
end
- clear_attribute_changes(changes.keys)
primary_key = self.class.primary_key
scope = self.class.unscoped.where(primary_key => _read_attribute(primary_key))
@@ -508,6 +507,7 @@ module ActiveRecord
changes[locking_column] = increment_lock
end
+ clear_attribute_changes(changes.keys)
result = scope.update_all(changes) == 1
if !result && locking_enabled?