My application's index route gets data from server using Ember.$.getJSON(url) in the route's model hook. The response is then pushed to the store using pushPayload method. When I do foo.get('bars') where foo has many bars (still in the model hook), it results in empty bars. Seen from the server's response and the ember inspector though, the foo's bars actually have some data. So I investigated the foo.get('bars') using chrome's console, and found out the bar records are loaded in its canonicalState property. So my workaround is to use foo.get('bars.canonicalState') instead.
So far its working good, but since it feels hacky and I can't find the canonicalState property in ember's documentation, I would like to know if this is the right way of doing it? and why does this happen?
How you used it with canonicalState? I mean it would surely be like this,
RépondreSupprimer[ ]
0: Class
__ember1438091638965: "ember748"
__ember_meta__: Object
__nextSuper: undefined
_attributes: Object
_changesToSync: Object
_data: Object
_deferredTriggers: Array[0]
And then _data has all the data I need.
But I couldn't get that data..tried with array index [0] and getter methods as well..nothing worked.