Home > Net >  Consult to bring billings for some overdue days
Consult to bring billings for some overdue days

Time:04-26

I want to bring all billings that charging_due_date expires today or expired for 3, 7 or 15 days

Place.joins(:billings)
     .where("billings.charging_due_date IN (?)", overdue_days)

some idea?

CodePudding user response:

I would do this:

overdue_days = [Date.today, 3.days.ago, 7.days.ago, 14.days.ago]
Place.joins(:billings).where(billings: { charging_due_date: overdue_days })
  • Related