title: Rails model with foreign_key and link table
body: <p>I am trying to create a model for a ruby on rails project that builds relationships between different words. Think of it as a dictionary where the "Links" between two words shows that they can be used synonymously. My DB looks something like this:</p>
  
  <pre><code>Words
  ----
  id
  
  Links
  -----
  id
  word1_id
  word2_id
  </code></pre>
  
  <p>How do I create a relationship between two words, using the link-table. I've tried to create the model but was not sure how to get the link-table into play:</p>
  
  <pre><code>class Word &lt; ActiveRecord::Base
    has_many :synonyms, :class_name =&gt; 'Word', :foreign_key =&gt; 'word1_id'
  end
  </code></pre>