javascript - Ember-data "Assertion Failed: Error: Assertion Failed: The response from a findAll must be an Array, not undefined" -
javascript - Ember-data "Assertion Failed: Error: Assertion Failed: The response from a findAll must be an Array, not undefined" -
i have been stuck on issue quite awhile now. have thoroughly researched issue on stackoverflow , unable find solution.
i trying load json info application store ember-data , rails api. using ember-cli.
the error continuing is: assertion failed: error: assertion failed: response findall must array, not undefined
the application consists of several reports each have charts. server fires off request api (with uuid tacked on query string) , receives next json response:
{ reports: [ { id: 1, name: "report 1", description: "test study 1", display_order: 0, chart_ids: [ 1 ] }, { id: 2, name: "report 2", description: "test study 2", display_order: 1, chart_ids: [ 5, 6 ] } ] }
this route reports:
export default ember.route.extend({ setupcontroller: function(controller) { controller.set('model', this.store.find('report')); } });
and models:
var study = ds.model.extend({ name: ds.attr('string'), description: ds.attr('string'), displayorder: ds.attr('integer'), charts: ds.hasmany('chart', { async: true }) }); var chart = ds.model.extend({ reports: ds.belongsto('report'), config: ds.attr() });
i using activemodeladapter , activemodelserializer:
applicationadapter:
export default ds.activemodeladapter.extend({ namespace: 'api', ajax: function(url, type, hash) { if (ember.isempty(hash)) { hash = {}; } if (ember.isempty(hash.data)) { hash.data = {}; } hash.data.uuid = $.cookie('uuid'); this._super(url, type, hash); } });
and serializer:
export default ds.activemodelserializer.extend();
i'm frustrated @ moment. ember debugger isn't beingness helpful. help super appreciated.
let me know if more info helpful.
i'm pretty sure needs charts_ids
instead of chart_ids
(note s
after chart) in json response reports.
or alter hasmany chart (though seems weird)
var study = ds.model.extend({ name: ds.attr('string'), description: ds.attr('string'), displayorder: ds.attr('integer'), chart: ds.hasmany('chart', { async: true }) });
you're not returning ajax.
app.applicationadapter= ds.activemodeladapter.extend({ namespace: 'api', ajax: function(url, type, hash) { if (ember.isempty(hash)) { hash = {}; } if (ember.isempty(hash.data)) { hash.data = {}; } hash.data.uuid = $.cookie('uuid'); homecoming this._super(url, type, hash); } });
http://emberjs.jsbin.com/oxidivu/678/edit
javascript ruby-on-rails json ember.js
Comments
Post a Comment