We are using Ember together with Ember-Data and are stumped by following setup:
There is a parent object (Epic
) which has a number of children (UserStory
). We have modelled this accordingly using ember-data:
App.Epic = DS.Model.extend({
name: DS.attr("string"),
description: DS.attr("string"),
project: DS.belongsTo("App.Project")
});
App.UserStory = DS.Model.extend({
name: DS.attr("string"),
description: DS.attr("string"),
goal: DS.attr("string"),
benefit: DS.attr("string"),
epic: DS.belongsTo("App.Epic")
});
What we would like to achieve now, is that we a have a list of independent forms to edit the Epic
inline with all of its UserStories
. Obvisouly we would simply deliver all of the UserStories
together with the Epic
via the RESTAdapter
. Yet we are afraid that this would lead to ugly update scenarios: changing one UserStory
would trigger a update of the entire Epic
with all of its UserStories
. In our architecture a UserStory
is an indepenent entity which should be maintained by a dedidacted REST service.
As an ember-newbie we would like to implement something in the lines of:
- Load the
Epic
via ember-data - Extend the
EpicController
to load allUserStories
into a separate model-(list). - Changes to the
Epic
via the dedicated form fire a change to theEpic Rest Service
. - Magic: Changes to an individual
UserStory
form fire an isolated and individual change to theUser Story Rest Service
.
How can the magic be achieved?