brux
brux

Reputation: 29

Retrieve hasMany child records in route

I have the following route:

/projects/5/files

I read in the API that using find() and findAll() will automatically update any templates that use their results when records are pushed to the store. How can I do that with the child file records?

Take note that the file records are already in the store as they are returned embedded with the project response from the server.

Currently, this is the model hook in my projects/files.js route:

model() {
  return this.modelFor('project').get('attachments')
}

This works on first load but won't update when adding records to the store afterwards.

Upvotes: 1

Views: 45

Answers (1)

Lux
Lux

Reputation: 18240

Actually it does update!

Checkout this ember-twiddle!

You can not just add an attachment but also have to connect it to the project!

Upvotes: 1

Related Questions