title: Rails - Including associations with dynamic conditions
body: <p>Given a school model and a student model with the school having a has_many relation to student:</p>
  
  <pre><code>has_many :students, :conditions =&gt; proc  { "year_id=#{send(:active_year_id)}" }
  </code></pre>
  
  <p>where active_year_id is a method defined in the school model, I'm encountering an error that "active_year_id is undefined" when calling:</p>
  
  <pre><code>School.where(:active =&gt; true).includes(:students)
  </code></pre>
  
  <p>The condition works fine when I do, say, </p>
  
  <pre><code>School.where(:id =&gt; 10).students
  </code></pre>
  
  <p>Only when I try to use includes do I get that error. Is that the right behavior. If not, what am I doing wrong and how do I fix ?</p>
  
  <p>Using Rails 3.0.9, REE 1.8.7.</p>