title: How to create conditional join in Ecto Query?
body: <p>i have 2 models - User and ApiKey (user has_many api_keys) and i'm trying to create conditional join. I mean i'd like to load with single query User with his active ApiKeys. My current code looks like</p>
  
  <pre><code>query = from u in User, 
          join: a in assoc(u, :api_keys), 
          where: u.email == ^email,
          preload: [api_keys: a]
  user = Repo.one(query)
  Repo.preload user, api_keys: (from a in ApiKey, where: a.is_active == true)
  </code></pre>
  
  <p>But unfortunately as i see - preload method cannot change collection of api_keys when data is already preloaded.</p>
  
  <p>Could you please show me good example - how to preload only "active" api_keys?</p>