From 9d8fdfec38a145e3f5074fd8dc0216630c268e32 Mon Sep 17 00:00:00 2001 From: Josh Kalderimis Date: Wed, 9 Feb 2011 15:24:32 +0100 Subject: removed some duplication from LH issue 5505 regarding AR touch and optimistic locking [#5505 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Santiago Pastorino and José Ignacio Costa --- activerecord/lib/active_record/persistence.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'activerecord/lib/active_record/persistence.rb') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 3fd67078b4..4ccb7461a1 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -233,11 +233,7 @@ module ActiveRecord changes[column.to_s] = write_attribute(column.to_s, current_time) end - if locking_enabled? - lock_col = self.class.locking_column.to_s - previous_value = send(lock_col).to_i - changes[lock_col] = write_attribute(lock_col, previous_value + 1) - end + changes[self.class.locking_column] = increment_lock if locking_enabled? @changed_attributes.except!(*changes.keys) primary_key = self.class.primary_key -- cgit v1.2.3