I must have read every question on stack overflow regarding my issue and have not found a solution. I am very new to Ember and Node so please bear with me.
The server responds with this format:
{
"_id" : "53fddf59d72f9b4d3a3e164a"
"about" : [
{"from" : "foo"},
{"text" : "bar"},
... ]
}
My model looks like this:
App.About = DS.Model.extend({
from : DS.attr('string'),
text : DS.attr('string'),
...
}
Adapter & serializer:
App.ApplicationAdapter = DS.RESTAdapter.extend({
host: 'http://localhost:3000'
});
App.ApplicationSerializer = DS.JSONSerializer.extend({
primaryKey: '_id'
});
And my route:
App.AboutRoute = Ember.Route.extend({
model: function() {
return this.store.find('about');
}
});
Using handlebars:
<script type="text/x-handlebars" data-template-name="about">
<p>{{from}}</p>
</script>
The route will render, but the console gives the error:
DEBUG: ------------------------------- ember.js:3285
DEBUG: Ember : 1.3.0 ember.js:3285
DEBUG: Ember Data : 1.0.0-beta.5 ember.js:3285
DEBUG: Handlebars : 1.3.0 ember.js:3285
DEBUG: jQuery : 1.10.2 ember.js:3285
DEBUG: ------------------------------- ember.js:3285
generated -> route:application Object {fullName: "route:application"} ember.js:3285
Assertion failed: You must include anid
in a hash passed topush
ember.js:3285
generated -> controller:about Object {fullName: "controller:about"} ember.js:3285
Transitioned into 'about'
What am I doing wrong?!
Update:
Have accepted Kingpin2k's answer even though this was not the exact format I ended up using. See the comments for details.
Your format should have the type plural, and the id on the individual records.