Commit 835e0796 authored by Shinya Maeda's avatar Shinya Maeda
Browse files

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

parent 19f930979fcf
......@@ -74,7 +74,7 @@ module Helpers
# 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