diff options
author | Nick Rogers <ncrogers@gmail.com> | 2012-03-07 17:16:21 -0500 |
---|---|---|
committer | Nick Rogers <ncrogers@gmail.com> | 2012-03-07 17:16:21 -0500 |
commit | 03888825e26000cab4310c28c17146e05332667a (patch) | |
tree | e01dc17c035d8fc3e49ba4a0d7d0707d5871f3da /activerecord | |
parent | b700153507b7d539a57a6e3bcf03c84776795051 (diff) | |
download | rails-03888825e26000cab4310c28c17146e05332667a.tar.gz rails-03888825e26000cab4310c28c17146e05332667a.tar.bz2 rails-03888825e26000cab4310c28c17146e05332667a.zip |
Fix deleting from a HABTM join table upon destroying an object of a model with optimistic locking enabled. Issue #5332.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 2 |
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 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 |