aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-03-30 06:08:05 -0700
committerJon Leighton <j@jonathanleighton.com>2012-03-30 06:08:05 -0700
commit2eb111815d5f7a86a7dbd317075e396c94ab2c3d (patch)
treee6a5ced27b7fd486252b44b6d4f5dff304fcf58c /activerecord/lib/active_record
parent34320cd6ba3423be7e0828c1486601aca53abc82 (diff)
parent2931f413a51f75e7365ac7dfe2e0bc2a27224c94 (diff)
downloadrails-2eb111815d5f7a86a7dbd317075e396c94ab2c3d.tar.gz
rails-2eb111815d5f7a86a7dbd317075e396c94ab2c3d.tar.bz2
rails-2eb111815d5f7a86a7dbd317075e396c94ab2c3d.zip
Merge pull request #5334 from courtland/master
Fix deleting from a HABTM join table upon destroying an object of a model with optimistic locking enabled.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/locking/optimistic.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb
index 8266427b71..64433f580a 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