Skip to content

Instantly share code, notes, and snippets.

@SlyDen
Forked from koemeet/ee.js
Created March 25, 2016 16:28
Show Gist options
  • Save SlyDen/cd4ed4c2c86eae7abadc to your computer and use it in GitHub Desktop.
Save SlyDen/cd4ed4c2c86eae7abadc 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