title: Ruby on Rails guides document on Activerecord association incorrect?
body: <p>Wow I've been struggling with this for whole day, following the "official" ruby on rails guides document, and just discovered that I might have been misguided by the document all along. I just want to confirm if this is true.</p>
  
  <p>If you go to <a href="http://guides.rubyonrails.org/association_basics.html" rel="nofollow">http://guides.rubyonrails.org/association_basics.html</a> and under 2.10. self joins section it says:</p>
  
  <pre><code>class Employee &lt; ActiveRecord::Base
    has_many :subordinates, :class_name =&gt; "Employee"
    belongs_to :manager, :class_name =&gt; "Employee",
      :foreign_key =&gt; "manager_id"
  end
  </code></pre>
  
  <p>Now, I'm a newbie and just believed in this code (What else can I do?) and wrote some code that's a variation of this self join case. However the more I looked at it the more it didn't feel right. isn't <code>:subordinates</code> supposed to have the <code>:foreign_key</code> field instead of <code>:manager</code>? Anyway I've just changed it so that the code is something like:</p>
  
  <pre><code>class Employee &lt; ActiveRecord::Base
    has_many :subordinates, :class_name =&gt; "Employee", :foreign_key =&gt; "manager_id"
    belongs_to :manager, :class_name =&gt; "Employee"
  end
  </code></pre>
  
  <p>and now it's working. Am I missing something? Or is the official document wrong? It's hard to believe that the official document would present incorrect information but maybe that's the way it is.</p>