Skip to content

Instantly share code, notes, and snippets.

@LucasPadovan
Created January 13, 2014 14:33
Show Gist options
  • Save LucasPadovan/8401306 to your computer and use it in GitHub Desktop.
Save LucasPadovan/8401306 to your computer and use it in GitHub Desktop.
Clean payment reports and coupon payments
payment_reports = PaymentReport.where(medium: 'PagoFacil')
payments = Payment.where(payment_report_id: payment_reports.map(&:id))
payments.update_all(payment_report_id: nil)
payment_reports.destroy_all
@LucasPadovan
Copy link
Author

date = Date.parse('01/12/2013)
CouponPayment.where('created_at > ? AND payment_report_id IS NULL', date)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment