I'm trying to create a scope for invoice
. It's to be used in an aging view.
The invoice date is invoice.invdate
.
This didn't work - it thinks DateTime
is a table:
scope :thirtydays, where("DateTime.now - DATE(invdate) < ?", 31)
This is the pg error:
missing FROM-clause entry for table "datetime"