module DeleteYouLater::Model

Public Instance Methods

delete_dependents_later(assoc, scope: DeleteYouLater.configuration.scope, batch_size: DeleteYouLater.configuration.batch_size) click to toggle source
# File lib/delete_you_later/model.rb, line 3
def delete_dependents_later(assoc, scope: DeleteYouLater.configuration.scope, batch_size: DeleteYouLater.configuration.batch_size)
  klass = self.name

  after_commit on: :destroy do
    if send(assoc).exists?
      DeleteLaterJob.perform_later klass, id, assoc, scope: scope, batch_size: batch_size
    end
  end
end
destroy_dependents_later(assoc, scope: DeleteYouLater.configuration.scope, batch_size: DeleteYouLater.configuration.batch_size) click to toggle source
# File lib/delete_you_later/model.rb, line 13
def destroy_dependents_later(assoc, scope: DeleteYouLater.configuration.scope, batch_size: DeleteYouLater.configuration.batch_size)
  klass = self.name

  after_commit on: :destroy do
    if send(assoc).exists?
      DestroyLaterJob.perform_later klass, id, assoc, scope: scope, batch_size: batch_size
    end
  end
end