jeudi 2 juillet 2015

Ember Data : Encountered in payload, but no model was found for model name

I have this error when try call rest api : Encountered "companies" in payload, but no model was found for model name "company"

http://localhost:9000/api/insurance/travel/companies

Call example :

var companies = this.store.find("insurance/travel/company");

Model :

export default DS.Model.extend({
    name: DS.attr('string'),
    url: DS.attr('string'),
    logoUrl: DS.attr('string'),
    contactUrl: DS.attr('string'),
    moreUrl: DS.attr('string'),
    about: DS.attr('string')
})

JSON Example :

{
    "companies": [
        {
            "id": "id1",
            "name": "test",
            "url": "http://google.com",
            "logoUrl": "http://google.com",
            "contactUrl": "http://google.com",
            "moreUrl": "http://google.com",
            "about": "about text"
        },
        {
            "id": "id2",
            "name": "test 2",
            "url": "http://google.com",
            "logoUrl": "http://google.com",
            "contactUrl": "http://google.com",
            "moreUrl": "http://google.com",
            "about": "about text"
        }
    ]
}




Aucun commentaire:

Enregistrer un commentaire