I am trying to manually load data into store. Here is the link to the jsBin http://jsbin.com/uYUsuTu/1/edit?html,output
My model is defined as :
AS.AnalyticsRun = DS.Model.extend({
'exerciseId': DS.attr('number'),
'exerciseRunId': DS.attr('number'),
'evolutionRunIds': DS.attr('string'),
'analyticsTemplateId': DS.attr('number'),
'analyticsPlan': DS.attr('string'),
'commandScript': DS.attr('string'),
'queued': DS.attr('boolean'),
'final': DS.attr('boolean'),
'createdBy': DS.attr('string'),
'dateCreated': DS.attr('date'),
'lastUpdatedBy': DS.attr('string'),
'lastUpdated': DS.attr('date'),
'analyticsRunParameters': DS.attr('string'),
'evolutionRuns': DS.hasMany('evolutionRun')
});
and I am trying to load data into store like:
var run = {"analyticsRun": [{"id": 2,
"exerciseId": 1885,
"exerciseRunId": 1938,
"evolutionRunIds": null,
"analyticsTemplateId": 13,
"analyticsPlan": null,
"commandScript": "test",
"queued": false,
"final": false,
"createdBy": "Deewendra Shrestha",
"dateCreated": "2013-10-04T13:40:23Z",
"lastUpdatedBy": "Deewendra Shrestha",
"lastUpdated": "2013-10-04T13:40:23Z",
"analyticsRunParameters": null,
"evolutionRuns": []}],
"evolutionRuns": [
{"id": 1378, "name": "aff_parameters_dannon.Pretest.Dannon_pman_KK2"},
{"id": 1375, "name": "aff_parameters_dannon.Pretest.Dannon_pman_KM1"},
{"id": 1377, "name": "aff_parameters_dannon.Pretest.Dannon_pman_KM2"},
{"id": 1371, "name": "aff_parameters_dannon.Pretest.Dannon_pman_control"},
{"id": 1376, "name": "aff_parameters_dannon.Pretest.Dannon_pman_KK1"}
]};
this.get('store').push('analyticsRun', run);
to which I get the error
You must include an id
in a hash passed to push
Not sure what I did wrong here!
Thanks, Dee