Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-12-05 17:01:12 +0300
committerJan Provaznik <jprovaznik@gitlab.com>2018-12-07 00:00:19 +0300
commit4ded04119ce70f7a5dd8a49434675355563b591e (patch)
tree796c3becb8b910ee86050611b512890e45ce81d9 /app/models/concerns/fast_destroy_all.rb
parent9ccf8d032ff82841cdfe96e2abe4b1d317058244 (diff)
Allow pass additional options to use_fast_destroy
These options are then used when setting before destroy callback.
Diffstat (limited to 'app/models/concerns/fast_destroy_all.rb')
-rw-r--r--app/models/concerns/fast_destroy_all.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/concerns/fast_destroy_all.rb b/app/models/concerns/fast_destroy_all.rb
index 89aa6347fbe..1e3afd641ed 100644
--- a/app/models/concerns/fast_destroy_all.rb
+++ b/app/models/concerns/fast_destroy_all.rb
@@ -76,8 +76,8 @@ 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(prepend: true) do
+ def use_fast_destroy(relation, opts = {})
+ set_callback :destroy, :before, opts.merge(prepend: true) do
perform_fast_destroy(public_send(relation)) # rubocop:disable GitlabSecurity/PublicSend
end
end