Use prepend: true to evaluate always perform_fast_destroy than dependent: :destroy
This commit is contained in:
parent
8fd76a752b
commit
ecf8287ce5
|
@ -74,7 +74,7 @@ module FastDestroyAll
|
|||
# This method is to be defined on models which have fast destroyable models as children,
|
||||
# and let us avoid to use `dependent: :destroy` hook
|
||||
def use_fast_destroy(relation)
|
||||
before_destroy do
|
||||
before_destroy(prepend: true) do
|
||||
perform_fast_destroy(public_send(relation)) # rubocop:disable GitlabSecurity/PublicSend
|
||||
end
|
||||
end
|
||||
|
|
|
@ -80,9 +80,6 @@ class Project < ActiveRecord::Base
|
|||
|
||||
before_destroy :remove_private_deploy_keys
|
||||
|
||||
##
|
||||
# `use_fast_destroy` must be defined **before** `has_many` and `has_one` such as `has_many :relation, dependent: :destroy`
|
||||
# Otherwise `use_fast_destroy` performs against **deleted** rows, which fails to get identifiers of external data
|
||||
use_fast_destroy :build_trace_chunks
|
||||
|
||||
after_destroy -> { run_after_commit { remove_pages } }
|
||||
|
|
Loading…
Reference in New Issue