title: Rails 4: how to use named scope with has_many associations
body: <p>In my Rails 4 app Project (model) <code>has_many</code> Videos (model). I have a named scope in the videos model: </p>
  
  <pre><code>scope :live, where( is_deleted: 0, sent_to_api: 1 )
  </code></pre>
  
  <p>In one of my project views, I do this (project is an instance of Project):</p>
  
  <pre><code>project.videos.live.size
  </code></pre>
  
  <p>What I expect to get is the number of projects in <em>that specific project</em> but instead I get the number of videos in <em>any</em> project. It's as if <code>.live</code> is not returning a subset from <code>.videos</code> but rather replacing it.</p>
  
  <p>I see it explained <a href="https://stackoverflow.com/questions/3016983/chaining-named-scopes-not-working-as-intended">here</a> that chaining named scopes with one another should be combined with logical AND but when applied to an "association method" [&lt;--not sure the proper terminology for <code>.videos</code> in this context] that doesn't seem to be happening.</p>
  
  <p>What's the right way to do this?</p>