lundi 23 février 2015

Ember data: reuse one model for two guises

In the app user has two associations - billing address and company address which are identical



//address
export default DS.Model.extend({
email: DS.attr('string'),
country: DS.attr('string'),
zip: DS.attr('string'),
user: DS.belongsTo('user')
//...
});

//user
export default DS.Model.extend({
name: DS.attr('string'),
company: DS.belongsTo('address'),
billing: DS.belongsTo('address')
//...
});


How to pull this kind of trick?





Aucun commentaire:

Enregistrer un commentaire