diff options
Diffstat (limited to 'activerecord/lib/active_record/locking')
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index cae7a66fcc..c2f740a1e0 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -91,13 +91,10 @@ module ActiveRecord attribute_names.push(lock_col) - relation = self.class.unscoped - - affected_rows = relation.where( + affected_rows = self.class._update_record( + attributes_with_values_for_update(attribute_names), self.class.primary_key => id_in_database, lock_col => previous_lock_value - ).update_all( - attributes_with_values_for_update(attribute_names) ) unless affected_rows == 1 |