vendredi 21 août 2015

Ember data 2.0 access relationship from template

I'm having trouble accessing a relationship inside the ember templates

  • Ember & Ember Data 2.0.0
  • ActiveModelAdaptar - via plugin

Ember Store in console, shows that the current item has a relationship that is already computed, but I can't access it from template

enter image description here

Grouped Item Model

export default DS.Model.extend({
  group:          DS.belongsTo('group', { async :  false }),
  groupable_id:   DS.attr('number'),
  groupable_type: DS.attr('string'),
});

Group Model

export default DS.Model.extend({
    code:          DS.attr('string'),
    name:          DS.attr('string'),
    description:   DS.attr('string'),
    adyuz_site_id: DS.attr('number'),
    extra:         DS.attr(),
    display_as:    DS.attr(),
    items:         DS.hasMany('groupedItem', { async: false, inverse: 'group' }),
});

JSON

enter image description here

Any suggestions, migration deprecations?




Aucun commentaire:

Enregistrer un commentaire