title: Working With Multiple Data Sources in Ember.js
body: <p>So I've been working hard establishing an app, and I'd like to now integrate a third party API using it's own data adapter.  I'd like to go about this in the most re-usable way so I've registered this adapter with the proper model (<strong>coffeescript warning</strong>):</p>
  
  <pre><code>App.Store.registerAdapter 'App.Workauth', DS.GUTSAdapter.extend
  </code></pre>
  
  <p>however here's where things get tricky: I want to do a lookup based on two attributes set on the User model:</p>
  
  <pre><code>App.User = DS.Model.extend
    workauths: DS.hasMany 'App.Workauth'
    token: DS.attr 'string'
    ldap: DS.attr 'string'
  </code></pre>
  
  <p> </p>
  
  <pre><code>App.Workauth = DS.Model.extend
    worker: DS.belongsTo 'App.User'
  </code></pre>
  
  <p>With both the token and ldap we can make an API request, and the adapter for Workauths looks something like this:</p>
  
  <pre><code>DS.GUTSAdapter = DS.Adapter.extend Ember.Evented,
  
    findWorkauths: (user, name, process) -&gt;
      token = worker.token
      ldap = "#{ user.ldap }"
      $.getJSON url, \
            ldap_username: ldap, \
            ldap_auth_token: token, \
        (data, status, jqxhr)-&gt;
          workauths=( \
            gutsId:workauth.work_auth_id, \
            name:workauth.work_auth_name, \
            hours:workauth.work_auth_hours, \
            due:workauth.work_auth_due_date \
            for workauth in data).unique gutsId
          process(workauths).load()
  </code></pre>
  
  <p>If these bindings exist, shouldn't it just be as simple as creating an outlet for User.Workauths {{render 'workauths/index'}} in my templates?  Ideally I'd think that it would do the lookup at render time, using the user token and ldap from the parent view.</p>
  
  <p>Thanks in advance!</p>