aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorJosh Kalderimis <josh.kalderimis@gmail.com>2011-02-09 15:24:32 +0100
committerSantiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>2011-02-09 18:28:15 -0200
commit9d8fdfec38a145e3f5074fd8dc0216630c268e32 (patch)
tree6b45692cd0947d6d8aced25ae055fe93ca51e9db /activerecord/lib/active_record/persistence.rb
parent8bc464c8090f2929917ecd2d9476c914aa6da787 (diff)
downloadrails-9d8fdfec38a145e3f5074fd8dc0216630c268e32.tar.gz
rails-9d8fdfec38a145e3f5074fd8dc0216630c268e32.tar.bz2
rails-9d8fdfec38a145e3f5074fd8dc0216630c268e32.zip
removed some duplication from LH issue 5505 regarding AR touch and optimistic locking [#5505 state:resolved]
Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb6
1 files changed, 1 insertions, 5 deletions
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