vendredi 7 octobre 2016

Error while processing route: home No model was found for 'App.undefined'

DEBUG: Ember      : 1.7.1
DEBUG: Ember Data : 1.0.0-beta.12
DEBUG: Handlebars : 1.1.2
DEBUG: jQuery     : 1.10.2

Having an issue with what I believe is the belongsTo attribute on my user model. (This happens on my other belongsTo attributes within my application as well). I have a Django backend which returns a response when I comment out the network: attribute.

{
    email: "test@test.com",
    first_name: "Test",
    global_code: "daht64q691zy4k887ch",
    global_id: "GBID-USER-dat64q6917zy4k887ch",
    institution_gbid: "GBID-GINS-567j53ey0lojsu2kys",
    institution_name: "Some University",
    last_name: "Testing",
    network: { },
    view_policy: {
        capability: "system:view",
        description: "Anyone can view a user",
        hold: true,
        id: "daht64q691y4k887ch:system:view",
        values: ""
    }
}

Code for the User Model:

App.User = DS.Model.extend({
        first_name: DS.attr('string'),
        last_name: DS.attr('string'),
        global_id: DS.attr('string'),
        network: DS.belongsTo('basicgrouping')
        }):

Code for Basic Grouping model:

App.Basicgrouping = DS.Model.extend({
        global_id: DS.attr('string'),
        name: DS.attr('string'),
        gbid_code: function(){
            return getGBIDCode(this.get('global_id'));
        }.property('global_id')
    });

Debugging ember-data I placed a console.log() within the following code:

  relationshipsByName: Ember.computed(function() {
    var map = Map.create();

    this.eachComputedProperty(function(name, meta) {
      console.log(name, meta);
      if (meta.isRelationship) {
        meta.key = name;
        var relationship = relationshipFromMeta(this.store, meta);
        relationship.type = typeForRelationshipMeta(this.store, meta);
        map.set(name, relationship);
      }
    });

Console response from the method

This seems to show that the type of the object that it belongs to is not being found (Basicgrouping) as it's returning App.undefined.

My theory is it may have something to do when parsing the server response and maybe the payload response. This also happens in other belongTo relationships in my code.




Aucun commentaire:

Enregistrer un commentaire