Handle dependent destroy via active jobs
问题 I have a couple models with many children. Dependent destroy has gotten really heavy. Anyone know of a way to tie dependent destroy into active jobs? Or, is my only option to remove dependent destroy and role my own jobs via callbacks on the parent model? 回答1: You can create a worker to destroy the models async and enqueue it's deletion. Something like: class ComplexModelDeletion < ActiveJob::Base def perform(model) model.destroy! end end And the model could be something like: class Model <