0
votes

I have a Project Model, and each one hasMany tasks and a simple template :

<ul>
{{#each task in tasks}}
  <li>{{task.name}</li>
{{/each}}
</ul>

It works fine and I can display the task list for each project by accessing /project/:id

I would like to display in my header a dropdown with the list of all projects, but I dont want to load all the tasks attached to each project, as this would be a lot of objects. Currently my projects.json does not include the "tasks" attribute, but the project/:id.json does.

What is the best way to achieve this ?

Should I use async: true in my hasMany association, and return the ids of the tasks in my projects.json, or is is a way to avoid this ?

1

1 Answers

0
votes

I don't think there is a recommended solution out there at this point.

You can read up on this discussion of "partial" loading with ember which has some good related SO issues.

One low tech way to achieve it that I am considering is to create a light object for the listing and link to the detail object via an action that finds the detailed object of the same ID.