Commit ecf8287c authored by Shinya Maeda's avatar Shinya Maeda

Use prepend: true to evaluate always perform_fast_destroy than dependent: :destroy

parent 8fd76a75
......@@ -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 } }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment