Joined April 2013
·

Philip Poots

Newcastle upon Tyne
·
·

Just a note to say that if you want the relationship to be bi-directional, i.e., be able to fetch the post from a comment, you can specify the post id on the Comment model in the fixtures, e.g.,

App.Comment.FIXTURES = [{
  id: 1,
  title: 'Big brother is watching you!',
  content: 'Smith! You’re being watched!',
  post: '1'
}];

Notice that I used a String, not a Number this time round. It seems that the FixtureAdapter requires a String for this to work because it doesn't do any conversions. See the answer to this SO question.

Thanks for a good introduction to the hasMany relationship in Ember Data.

Achievements
1 Karma
0 Total ProTip Views
Interests & Skills