Reputation: 173
I have this working ember snip: http://jsfiddle.net/wUC9w/
with the following 2 models:
App.Card = DS.Model.extend
title: DS.attr("string")
description: DS.attr("string")
template: DS.belongsTo("template", {async: true})
App.Template = DS.Model.extend
title: DS.attr("string")
cards: DS.hasMany("card", {async: true})
However it's refusing to connect the two models in the cards view, (it doesn't get the title of the linked template). I've tried using {async: true} side-loading and preloading the related template model in the app but ember still doesn't connect the two.
I've looked all over the ember docs and asked in IRC with much help but no luck, Any observations would be greatly appreciated!
Upvotes: 0
Views: 312
Reputation: 173
Thanks kingpin2k,
on a belongsTo relationship the json for the fk should be name_id (so in this case template_id) when using the active model serializer.
For reference: https://github.com/emberjs/data/blob/master/TRANSITION.md#underscored-keys-_id-and-_ids
Upvotes: 1