The problem arises from the fact that I have some data in backend which when presented has to be formed in different way than how they are stored, or at least this is my conception after reading some guides and docs about emberjs so I want to know what would an ember profi do.
To be concrete, on the backend I have a data structure which presents days (with full date like 2014-07-16) and have a bunch of data attached to each day. On the client however I need to present the data structured under years, weeks and then day.
So I setup some nested route like this:
WorkTime.Router.map(function() {
this.resource('year', {
path: '/:year'
},
function() {
this.resource('week', {
path: '/:week'
},
function() {
this.resource('day', {
path: '/:day'
},
function() {
});
});
});
});
This implies the right structure that I need for the sake of presentation. Now the question is how should I approach toward needed models?
One solution that I can think of is to define the models for year, week and day. The first two are not stored on server (as they are really presentation only) and day has some computed attributes (like year and weeknumber) which then gives the right binding to year and week models. This however means that each time application starts, has to receive the days' records, and generate local records for year and week. Im not sure if this is even supported in ember.
Is this a proper approach? would an ember profi do it?
Just to note: I'm using ember 1.6.0 with ember data 1.0.0 beta 8.