title: How can I create new records with has_many :through and honor :conditions?
body: <p>Let's say I have a Course in which Students can enroll via a Membership (e.g. a has_and_belongs_to_many relationsip of Courses and Students).  Some memberships are for students who are just observing the class (not for credit, etc.), so:</p>
  
  <pre><code>class Course &lt; ActiveRecord::Base
    has_many :memberships
  
    has_many :students,
             :through =&gt; :memberships
  
    has_many :observers,
             :through =&gt; :memberships,
             :source =&gt; :student,
             :conditions =&gt; { :memberships =&gt; { :observer =&gt; true }}
  end
  </code></pre>
  
  <p>Here's what works great:</p>
  
  <pre><code>observers = Course.find(37).observers
  </code></pre>
  
  <p>Here's what doesn't work:</p>
  
  <pre><code>new_observer = Course.find(37).observers.build(:name =&gt; 'Joe Student')
  </code></pre>
  
  <p>I would have thought that one could build new records using the association and that would have generated:</p>
  
  <ol>
  <li>A new Student record ('Joe Student')</li>
  <li>A new Membership record (course_id = 37, student_id = (joe), observer = true)</li>
  </ol>
  
  <p>But instead I get:</p>
  
  <pre><code>ActiveRecord::AssociationTypeMismatch: Membership expected, got Array
  </code></pre>
  
  <p>I'm sure I'm totally confused about how this and would appreciate any insights!  I've also tried to do this with named scopes on the Membership model, but I can't seem to get has_many to use a scope in the association.</p>
  
  <p>Thanks so much for any help possible!</p>