Last active
March 25, 2016 16:28
-
-
Save koemeet/c4232b285882e33fd4ed to your computer and use it in GitHub Desktop.
Inverse relationships issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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