Open dslamba opened 9 years ago
Faced the same issue today. Quick and dirty work-a-round: Use a computed property as content which maps the RecordArray to a normal array. A fix would be great!
To be clear, I've never used Ember.Data
. So my understanding of its data schema is a bit limited. Would anyone with a more failure understanding of what Ember.Data
wants/expects be willing to experiment a PR? I'm ok entertaining a WIP just to get me started in the right direction.
I can give it a shot later. Right now you have code that takes the content object and converts it to an array. That conversion, uses a function which treats the response from Ember Data as an object and returns it as an Object. Instead we need to check if object is of the Ember.Enumerable time, if so treat it as an array.
Also, will need to loop over the content array using forEach instead of the (var i = 0; i < X.length) syntax.
So my script uses map
which is an Array function which Ember.Enumerable
has. However to be safe with what comes in I wrap the content
with Ember.makeArray()
which in turn tests the object with Ember.isArray()
does an Ember.Enumerable
not respond true
with makeArray()
?
The response type from those is an RecordArray, which needs a forEach to loop.
IF content property is set to such an array returned from store.find(), it treats it like one object not an array.