samedi 1 août 2015

How do I create a relationship in ember-cli-mirage?

I'm trying to create Relationships in Ember-Cli-Mirage. Is this possible in a simple way or do I have to use fixtures instead of factories?

These would be my models:

TASK:

export default DS.Model.extend({
  taskName: DS.attr('string'),
  team: DS.hasMany('team', {async: true}),
  taskScore: DS.hasMany('taskScore', {async: true})
});

TEAM:

import DS from 'ember-data';

export default DS.Model.extend({
  teamName: DS.attr('string'),
  task: DS.hasMany('task'),
  taskScore: DS.hasMany('taskScore', {async: true})
});

TASKSCORE:

import DS from 'ember-data';

export default DS.Model.extend({
    score: DS.attr('number'),
    team: DS.belongsTo('team'),
    task: DS.belongsTo('task'),
});




Aucun commentaire:

Enregistrer un commentaire