Uncaught Error: Assertion Failed: Error: Assertion Failed: Your server returned a hash with the key projects but you have no mapping for it

Hi there ,

I am having these two errors

  1. Uncaught Error: Assertion Failed: Error: Assertion Failed: Your server returned a hash with the key projects but you have no mapping for it

  2. Error: Assertion Failed: Your server returned a hash with the key projects but you have no mapping for it

And I don’t know how to solve these. My JsonData Format is like this:

{ “projects”: [{ “project_id”: 1, “project_name”: “AAA” }] }

And the contents in App.js are : App.Router.map(function() { this.resource(‘projects’); });

App.Store = DS.Store.extend({ revision: 12, adapter: DS.RESTAdapter.extend({ url: ‘http://portNum/pathToJsonData’ })

});

App.ProjectsRoute = Ember.Route.extend({ model: function(){ return App.Projects.find(); } });

App.Projects = DS.Model.extend({ project_id: DS.attr(‘integer’), project_name: DS.attr(‘string’) });

And in index.html I am using :

        {{#each model}}
        <tr><td>
          {{project_name}}
        </td></tr>
        {{/each}}

So,this is it,Please help thanks in advance

As a first step I would change your model name from App.Projects to App.Project. With your current model name (Projects) ED will look for the pluralization of Projects as a root key. By changing your model name to App.Project, ED will correctly look for projects as the root key. I hope this helps.

PS. ED uses id as the default pk. I suggest that you either follow the conventions of ED (recommended), or look into configuring ED to look for the pk you appear to be using (project_id).

Its working now ,sir.Thank you so much

You are very welcome :slight_smile: