Skip to content

Instantly share code, notes, and snippets.

@pythonandchips
Last active February 17, 2021 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pythonandchips/1c556f8adc08672bf316778bbed96038 to your computer and use it in GitHub Desktop.
Save pythonandchips/1c556f8adc08672bf316778bbed96038 to your computer and use it in GitHub Desktop.
Remove recurring invoices
def delete_all_recurring_invoices
progress_bar = ProgressRateLimiter.new(count: Invoice.where(type: "RecurringInvoice").count)
Invoice.where(type: "RecurringInvoice").find_each do |recurring_invoice|
recurring_invoice.destroy!
progress_bar.increment!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment