I have a “model” “movie” with fields:
name: string id: number description: string genre: string actors: string director: string year: number
On a summary view i display only name and id, genre, actors . When i go into details of a movie i display also description, director and year.
Because description is long i would like to load only name and id when being on a summary page and then when i go into details i would like to display also description. I have one endpoint to get id and name, and second to get id, name and description.
My current solution is that i have two models: movie and moviesummary.
id: string name: string genre: string actors: string
id: string name: string description: string director: string year: number
And movie calls one endpoint to populate itself, and moviesummary second endpoint. This works. Thus disadventages of this solution is that you need to make sure to have updated summary after details change.
For example when i go into details page and edit name, i need somehow to update summary. Currently i do it by reloading data each time user goes into summary page. But this is not very good because synchronisation issues.
Is this a correct approach in Ember? Or should i do it other way?
Especially is it possible to have movie and moviesummary inside one model and populate it depending on needs from two endpoints?
When i tried to do it with single model it didn’t work. Because when summary is loaded, Ember does not ask again for the same record from the detailed endpoint.