title: Active Record Query Using Associated Model in Find Clause
body: <p>I'm having a blonde moment and probably a brain freeze.</p>
  
  <p>In my rails3 app, I have users and tasks. My users have many tasks...</p>
  
  <p>I have due and overdue tasks as follows:</p>
  
  <pre><code>@due = Task.find(:all, :conditions =&gt; ["dueddate &gt;= ? AND AND status = ?", Date.today, false], :include =&gt; :taskcategories, :order =&gt; "dueddate asc")  
  </code></pre>
  
  <p>What I want to do in my tasks view, is list the users with due tasks...</p>
  
  <p>For some reason, I can't get my head around it. I have tried this, but it's not working:</p>
  
  <pre><code>@task = Task.all
  
  @user = User.find(:all, :conditions =&gt; ["@task.dueddate &lt;= ? AND 
  @task.status = ?", Date.today + 7.days, false])
  </code></pre>
  
  <p>I'm sure this is easy, can anyone help me!!?</p>