Skip to content

Instantly share code, notes, and snippets.

@SlyDen
Forked from koemeet/ee.js
Created March 25, 2016 16:28
Show Gist options
  • Select an option

  • Save SlyDen/cd4ed4c2c86eae7abadc to your computer and use it in GitHub Desktop.

Select an option

Save SlyDen/cd4ed4c2c86eae7abadc to your computer and use it in GitHub Desktop.

Revisions

  1. @koemeet koemeet revised this gist Mar 24, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ee.js
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ export default DS.Model.extend({

    // app/models/product-variant.js
    export default DS.Model.extend({
    product: DS.belongsTo('product'),
    product: DS.belongsTo('product', { inverse: null }),
    master: DS.attr('boolean')
    });

  2. @koemeet koemeet revised this gist Mar 24, 2016. No changes.
  3. @koemeet koemeet created this gist Mar 24, 2016.
    12 changes: 12 additions & 0 deletions ee.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    // 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'),
    master: DS.attr('boolean')
    });