title: How can I associate students to the school through two levels (courses and course sections) in rails 3.1?
body: <p>A school has many courses.  A course has many sections.  A student enrolls in a section of a course.  I want to be able to find all the students at the school.</p>
  
  <pre><code>Class School &lt; ActiveRecord::Base
    has_many :courses
    has_many :sections, :through =&gt; courses
    has_many :students, :through =&gt; courses, :through =&gt; sections, :through =&gt; enrollments
  end
  
  Class Course &lt; ActiveRecord::Base
    belongs_to :school
    has_many :sections
    has_many :students, :through =&gt; sections, :through =&gt; enrollment
  end
  
  Class Section &lt; ActiveRecord::Base
    belongs_to :course
    has_many :students, :through =&gt; enrollment
  end
  
  Class Student &lt; ActiveRecord::Base
    has_many :sections, :through =&gt; enrollment
    has_many :courses, :through =&gt; sections, :through =&gt; enrollment
    has_many :schools, :through =&gt; courses, :through =&gt; sections, :through =&gt; enrollment
  end
  </code></pre>
  
  <p>enrollment is just a table with the section id and student id when a student enrolls in that section of the course.</p>
  
  <p>Is there a better way to do what I am trying to do here?</p>
  
  <p>Thanks.</p>