diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-10-28 12:24:07 -0600 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-10-28 12:24:07 -0600 |
commit | f7d0a3ba7e9e676d399e7aeed7485a8bf03992f8 (patch) | |
tree | 2021a3477af697b70198a739082befd7780ff321 /activerecord/lib/active_record/callbacks.rb | |
parent | d74c89ac16aa87f3bc166450e8d4b87382da17a4 (diff) | |
parent | d5bf649a535948e70692e521ce3070595334e71b (diff) | |
download | rails-f7d0a3ba7e9e676d399e7aeed7485a8bf03992f8.tar.gz rails-f7d0a3ba7e9e676d399e7aeed7485a8bf03992f8.tar.bz2 rails-f7d0a3ba7e9e676d399e7aeed7485a8bf03992f8.zip |
Merge pull request #18548 from sebjacobs/support-bidirectional-destroy-dependencies
Add support for bidirectional destroy dependencies
Diffstat (limited to 'activerecord/lib/active_record/callbacks.rb')
-rw-r--r-- | activerecord/lib/active_record/callbacks.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index bfedc4af3f..cfd8cbda67 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -292,10 +292,15 @@ module ActiveRecord end def destroy #:nodoc: + @_destroy_callback_already_called ||= false + return if @_destroy_callback_already_called + @_destroy_callback_already_called = true _run_destroy_callbacks { super } rescue RecordNotDestroyed => e @_association_destroy_exception = e false + ensure + @_destroy_callback_already_called = false end def touch(*) #:nodoc: |