App.User = DS.Model.extend({ posts: DS.hasMany('post', {async: true}) }); App.Post = DS.Model.extend({ body: DS.attr(), user: DS.belongsTo('user') }); App.ProfileRoute = Ember.Route.extend({ model: function(params) { return this.get('store').find('user', params.user_id) } });
and in the template
{{
json for the user. I do not want to embed messages in user json
{user: { posts: [1, 2, 3] }}
It does not display anything. It receives json messages from the server after this error occurs.
Assertion failed: you looked at the "posts" relationship on "", but some related posts were not loaded. Either make sure that they are all loaded with the parent record, or indicate that the relation is async ( DS.attr({ async: true })
)
In the chrome inspector, I see that all the data is loaded properly. How can i solve this? Do I have to preload all the models that I want to use in the templates?
source share