I dont understand the Error on ember-data :( kinldly help thank you


#1

I can’t display the list of inventory i have. it has 3 ralationship tied together kindly help

Ember Inspector 1.3.1 Ember 1.5.1 Ember Data 1.0.0-beta.8.2a68c63a Handlebars 1.2.1 jQuery 1.9.1

 Uncaught #<error> VM23052:956
    ProfileManager.ended VM23052:956
    Ember.subscribe.after VM23052:2007
    finalizer ember.js:1802
    Ember.tryCatchFinally ember.js:1554
    Ember.Instrumentation.instrument ember.js:1810
    Ember.CoreView.Ember.Object.extend.renderToBuffer ember.js:22472
    Ember.View.Ember.CoreView.extend.createElement ember.js:23993
    Ember.merge.insertElement ember.js:24944
    Ember.View.Ember.CoreView.extend._insertElement ember.js:23921
    DeferredActionQueues.flush ember.js:6125
    Backburner.end ember.js:6215
    Backburner.run ember.js:6254
    Ember.run ember.js:6664
    hash.success ember-data.js:2010
    fire jquery.js:1037
    self.fireWith jquery.js:1148
    done jquery.js:8074
    callback
    
    Here is my Model
    /*global Ember*/
    Erp.Item = DS.Model.extend({
    
        name: DS.attr('string'),
        productCode: DS.attr('string'),
        description:DS.attr('string'),
        sku:DS.attr('string'),
        weight:DS.attr('string'),
        barcode:DS.attr('string'),
        status:DS.attr('string'),
        brand:DS.belongsTo('brand', { async: true }),
        category:DS.belongsTo('category', { async: true }),
        isSaleItem:DS.attr('boolean'),
        isPurchaseItem:DS.attr('boolean'),
        isStockItem:DS.attr('boolean'),
        inventories: DS.hasMany('inventory')
    
    });
    
    Erp.Inventory = DS.Model.extend({
        companyLocation: DS.belongsTo('companyLocation'),
        item: DS.belongsTo('item'),
        productAvailable: DS.attr('number'),
        productQuantity:  DS.attr('number'),
        productToReorder:  DS.attr('number'),
        pendingPurchaseQuantity: DS.attr('number'),
        pendingSaleQuantity: DS.attr('number')
    //    category: DS.belongsTo('category')
        /*
         uom: DS.belongsTo('uom'),
         is_sale_item: DS.attr(),
         is_purchase_item:  DS.attr(),
         is_stock_item: DS.attr(),
         created: DS.attr(),
         modified: DS.attr()
         */
    });
    
    Erp.CompanyLocation = DS.Model.extend( Ember.Validation.ValidatorSupport, {
        validator: Ember.Validation.map(function () {
            this.property("location")
                .required()
                .message("location name must not be empty");
            this.property("address")
                .required()
                .message("address must not be empty");
            this.property("email")
                .mail()
                .message("email not a valid ");
    
        }),
    
        location: DS.attr('string'),
        address:DS.attr('string'),
        email:DS.attr('string'),
        phone: DS.attr('string'),
        mobile: DS.attr('string')
    
    });
    
    <h3>Stocks</h3>
    
    {{#each inventory in inventories}}343242
    {{/each}}

#2

Model for brand and for category lacks from your list.

Still the error should be different. Can you give more information about when the error is produced?

Do you work with fixtures? Almost all your relations are provided without async:true, in this case you must provide all your related model at one, in the same payload.


#3

thank you async help a lot