title: Ember Relationships without Ember Data
body: <p>I have an Ember App where some Models use Ember Data and some don't. My question relates to creating relationships between these Models and also the best way to structure the Model relationships.</p>
  
  <h2>Models</h2>
  
  <p>Currently I have the following Models:</p>
  
  <ul>
  <li>Foods
  <ul>
  <li><em>not</em> using Ember Data</li>
  <li>makes $.ajax request to external API</li>
  <li>extends a <code>Ember.Object</code> (see <a href="http://eviltrout.com/2013/03/23/ember-without-data.html" rel="nofollow">here</a> and <a href="http://www.smashingmagazine.com/2013/11/07/an-in-depth-introduction-to-ember-js-2/#what_about_not_using_emberdata" rel="nofollow">here</a> for examples of the methodology)</li>
  </ul></li>
  <li>Meals
  <ul>
  <li>uses Ember Data</li>
  <li>has many Portions</li>
  </ul></li>
  <li>Portions
  <ul>
  <li>uses Ember Data</li>
  <li>hasOne Meal</li>
  <li>hasOne Food</li>
  </ul></li>
  </ul>
  
  <p>In my app I need a Portion to be a unique record which has a <code>weight</code> field. Each Portion should derive it's other values from a associated <code>Food</code>. A Meal should contain many Portions.</p>
  
  <h2>Questions</h2>
  
  <ol>
  <li>Should Portions be a Model in it's own right our should it be stored in some kind of array-like structure as a field on the <code>Meal</code> (eg: <code>portions</code>)? Consider that a Portion is not reusable and is only able to be associated with a single Meal. </li>
  <li>If "Yes" to #1 then what could my <code>Meal</code> Model def look like?</li>
  <li>As <code>Food</code> does not use Ember Data what's the best technique for defining a relationship between a Portion and a Food?</li>
  </ol>
  
  <p>Ultimately the User experience should allow someone to </p>
  
  <ol>
  <li>View a Food</li>
  <li>Create a Portion of that Food</li>
  <li>Associate the Portion with a Meal</li>
  <li>View all Portions associated with a Meal</li>
  </ol>
  
  <p>Your help is much appreciated.</p>