I've looked at release notes but can't find anything that mentions changes to how RSVPs work, but is there a reason this isn't working?
On the route, a very simple model:
model() {
return RSVP.hash({
posts: get(this, 'store').findAll('post')
});
}
and in the template:
{{#each posts as |post|}}
{{post.title}}
{{/each}}
Returns nothing, however if I use a standard model call such as
model() {
return get(this, 'store').findAll('post');
}
with
{{#each model as |post|}}
{{post.title}}
{{/each}}
It works as expected. I've done many many apps on previous 2.9.0 and never had a problem with this...
Little confused!
RSVP.hash
returns an object where each key holds a resolved value from a promise.
In your case this means that the model
will be { posts: ... }
so you're just missing a .posts
property chain call:
route:
model() {
return RSVP.hash({
posts: get(this, 'store').findAll('post')
});
}
template:
{{#each model.posts as |post|}}
{{post.title}}
{{/each}}
If you want to use this template
{{#each posts as |post|}}
{{post.title}}
{{/each}}
You can set posts
in setupController
:
model() {
return RSVP.hash({
posts: get(this, 'store').findAll('post')
});
}
setupController(controller, model) {
controller.set('posts', model.posts);
}