title: Rails where condition with nested associations
body: <p>Let's say I have <code>Delivery</code> model which has one <code>Postman</code> and that <code>Postman</code>has many <code>Team</code>s.</p>
  
  <p>I would like to get all deliveries with specific team ID = 1 for example.</p>
  
  <p>I have try:</p>
  
  <pre><code>Delivery.joins(:postman).where(:postmans =&gt; {team_ids: 1})
  </code></pre>
  
  <p>But I couldn't manage to get them. How can I achieve this? </p>