From 05e1466e059a12bddd066a9f22ca575d81cfc21d 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. Fixes #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 7deac2588a..b2881991d5 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -102,6 +102,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