Rails 6 first added the option to destroy dependencies asynchronously. It allowed cascading destroys to be offloaded into a background process for more scalable solutions.
Like all the other Rails magic, this was provided out of the box. Fortunately, a configuration option was also provided to override the default job that performs these destroys. However, that was not being adhered to!
Before
The default job that destroys
all dependencies is ActiveRecord::DestroyAssociationAsyncJob
.
It does a great job out of the box,
however,
there was a bug that did not allow this
job to be overridden with the provided configuration option.
Let’s look at an example.
Now when we set the config.active_record.destroy_association_async_job
option to use CustomDestroyAssociationAsyncJob
instead, it is not adhered.
After
Thanks to this PR it is now possible to override the default destroy association async job.