From 03888825e26000cab4310c28c17146e05332667a Mon Sep 17 00:00:00 2001 From: Nick Rogers Date: Wed, 7 Mar 2012 17:16:21 -0500 Subject: Fix deleting from a HABTM join table upon destroying an object of a model with optimistic locking enabled. Issue #5332. --- activerecord/lib/active_record/locking/optimistic.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 9b2dc096a0..7bd59382ae 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -104,6 +104,8 @@ module ActiveRecord def destroy #:nodoc: return super unless locking_enabled? + destroy_associations + if persisted? table = self.class.arel_table lock_col = self.class.locking_column -- cgit v1.2.3