I am working on proving the concept of an application, and I have a question about data storage.
There is a client model in my application
PM.Client = Ember.Object.extend({ id: null, client: null, projects: {} });
and project model
PM.Project = Ember.Object.extend({ id: null, title: null, totalHours: null, cost: function(){ return this.get('totalHours') * PM.get('rate'); }.property('totalHours') });
Each client can have several projects, but each project can have only one client. I currently have a dummy JSON file with the following data
[ { "id": "1", "client": "Fastbook", "projects": [ { "id": "1", "title": "Website redesign", "totalHours": "45", "cost": "4500" }, { "id": "2", "title": "Tidy up admin section", "totalHours": "10", "cost": "1000" } ] }, { "id": "2", "client": "Epicenter", "projects": [ { "id": "1", "title": "Chaching", "totalHours": "25", "cost": "2500" } ] } ]
What is the best way to store this data in Ember? Should I have an arrayController for clients and another for projects?
Ember data might be fine, but I don't plan on setting REST for this. Can Ember Data use localStorage?