diff options
Diffstat (limited to 'activerecord/lib/active_record/locking/optimistic.rb')
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 1251e9f013..bb28444b07 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -89,18 +89,11 @@ module ActiveRecord attribute_names.uniq! begin - table = Arel(self.class.table_name) - - attributes = {} - attributes_with_quotes(false, false, attribute_names).map { |k,v| - attributes.merge!(table[k] => v) - } - affected_rows = table.where( table[self.class.primary_key].eq(quoted_id).and( table[self.class.locking_column].eq(quote_value(previous_value)) ) - ).update(attributes) + ).update(arel_attributes_values(false, false, attribute_names)) unless affected_rows == 1 |