title: Rails has_many to same table
body: <p>I have 2 tables</p>
  
  <pre><code>ACCRELATIONS
  "ID"
  "ACCDETAILS"
  "ACCRELATIONSBIKEID"
  "ACCRELATIONSCARID"
  "ACCRELATIONSPERSONID"
  
  ACCPEOPLE
  "ID"
  "FIRSTNAME"
  "LASTNAME"
  "ACCRELATIONSID"
  </code></pre>
  
  <p>the relations should be something like </p>
  
  <pre><code>class ACCPEOPLE &lt; ActiveRecord::Base
  has_many :ACCRELATIONS, :foreign_key =&gt; 'ACCRELATIONSBIKEID'
  has_many :ACCRELATIONS, :foreign_key =&gt; 'ACCRELATIONSCARID'
  has_many :ACCRELATIONS, :foreign_key =&gt; 'ACCRELATIONSPERSONID'
  </code></pre>
  
  <p>Does this rails logic work? So basically an 'ACCPEOPLE' record can be joined on any of the three relations.</p>
  
  <p>EDIT====</p>
  
  <p>Thank you! I used the logic from your answer to fix the relation going the other way too now. Done by  adding the 3 relations as belongs_to in the other table.</p>