title: has_many :through association in the Rails tutorial
body: <p>I don't get something in the last chapter of the Rails tutorial.</p>
  
  <p>So the aim of this chapter to make friendships with other users, and that makes it a self referential association. (users have a relationship with other users)</p>
  
  <p>So with the User model, there is the Friendship model, that acts as a through table.</p>
  
  <p>And in the code, <strong>class User</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :microposts, dependent: :destroy
    has_many :active_relationships,  class_name:  "Relationship",
                                     foreign_key: "follower_id",
                                     dependent:   :destroy
    has_many :passive_relationships, class_name:  "Relationship",
                                     foreign_key: "followed_id",
                                     dependent:   :destroy
    has_many :following, through: :active_relationships,  source: :followed
    has_many :followers, through: :passive_relationships, source: :follower
    .
    .
    .
  end
  </code></pre>
  
  <p>But I don't get this part:</p>
  
  <pre><code>  has_many :following, through: :active_relationships,  source: :followed
    has_many :followers, through: :passive_relationships, source: :follower
  </code></pre>
  
  <p>We have to specify in the has_many :through association the table that we are going through (Relationship table). But in the above code there isn't an 
  :active_relationships or :passive_relationships table ,there's only a <strong>Relationship</strong> class.</p>
  
  <p><strong>The Relationship table:</strong></p>
  
  <pre><code>class Relationship &lt; ActiveRecord::Base
    belongs_to :follower, class_name: "User"
    belongs_to :followed, class_name: "User"
    validates :follower_id, presence: true
    validates :followed_id, presence: true
  end
  </code></pre>
  
  <p>So, my question is, how does that work?</p>
  
  <p>Tnx Tom</p>