 # frozen_string_literal: true

 class DestroyAsyncParent < ActiveRecord::Base
   self.primary_key = "parent_id"

   has_one :dl_keyed_has_one, dependent: :destroy_async,
     foreign_key: :destroy_async_parent_id, primary_key: :parent_id
   has_many :dl_keyed_has_many, dependent: :destroy_async,
     foreign_key: :many_key, primary_key: :parent_id
   has_many :dl_keyed_join, dependent: :destroy_async,
     foreign_key: :destroy_async_parent_id, primary_key: :joins_key
   has_many :dl_keyed_has_many_through,
     through: :dl_keyed_join, dependent: :destroy_async,
     foreign_key: :dl_has_many_through_key_id, primary_key: :through_key
 end

 # frozen_string_literal: true

 class DestroyAsyncParent < ActiveRecord::Base
   self.primary_key = "parent_id"

   has_one :dl_keyed_has_one, dependent: :destroy_async,
     foreign_key: :destroy_async_parent_id, primary_key: :parent_id
   has_many :dl_keyed_has_many, dependent: :destroy_async,
     foreign_key: :many_key, primary_key: :parent_id
   has_many :dl_keyed_join, dependent: :destroy_async,
     foreign_key: :destroy_async_parent_id, primary_key: :parent_id
   has_many :dl_keyed_has_many_through,
     through: :dl_keyed_join, dependent: :destroy_async,
     foreign_key: :dl_has_many_through_key_id, primary_key: :through_key
 end

Update primary key for dl_keyed_join
Update primary key for dl_keyed_join

The primary_key for the `dl_keyed_join` relation was incorrect. It
expected to use  a `joins_key` attribute on the parent record in order
to link to the `dl_keyed_join` record. The parent class does not have a
`joins_key` attribute at all, which means that association was never
setup correctly.

Co-authored-by: Daniel Colson <787fe058868b5b753ab9094fd2330d7ffa735976@github.com>
