My application has the concept of a "Loan". Each loan has a creditor, a debtor, and an amount.
From a database perspective, I know that I want the loans table to look something like this:
|id|Amount|creditor_id|debtor_id|
| 1| 100| 5| 7|
Where creditor/debtor ids reference User ids (i.e., the primary key for rows in my users table).
My question is how I should set this up in ActiveRecord. I can't do something like:
class Loan < ActiveRecord::Base
has_one :creditor
Since this will cause rails to look for a 'creditors' table (and the creditors are all stored in the users table).