Skip to content

Instantly share code, notes, and snippets.

@koemeet
Last active March 25, 2016 16:28
Show Gist options
  • Save koemeet/c4232b285882e33fd4ed to your computer and use it in GitHub Desktop.
Save koemeet/c4232b285882e33fd4ed to your computer and use it in GitHub Desktop.
Inverse relationships issue
// app/models/product.js
export default DS.Model.extend({
masterVariant: DS.belongsTo('product-variant'),
variants: DS.hasMany('product-variant') // only contains the variants that are not master
});
// app/models/product-variant.js
export default DS.Model.extend({
product: DS.belongsTo('product', { inverse: null }),
master: DS.attr('boolean')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment