I'm building a web-app where users can keep track of who owes whom money.
I have users and debts. Given a user I want to be able to find out all the debts to other users, and all the loans to other users. Given a debt I want to be able to find out who the debtor and lender are.
The asker of this question ran into a similar situation, but I don't belive our situations similar enough to warrant just using the top answer:
Taken from that question, the three paterns sugested there are
- well specified associations
- single table inheritance
- polymorphic association
What pattern should I use in my situation? One of these three, or is there an even more appropriate one?