delete all files not associated with a nontrashed card.
John said: "Make sure to check even if the current cardtype is not file or image - it may have been changed."
there is no "current card" when emptying trash.
you mean cards in the trash don't have a cardtype?
I mean you empty all the trash at once, not card by card. perhaps the code will explain it best:
def empty_trash
Card.where(:trash=>true).delete_all
User.delete_cardless
Card::Revision.delete_cardless
Card::Reference.repair_missing_referees
end
At no point in the process do you examine any card details. We would basically add another line that is essentially "delete cardless files". (And, of course, make that work)