I have a fairly complicated Ember.js object that I'd like to send with the initial HTML/javascript when the page loads (to avoid a separate trip to the server), but then allow the user to modify it.
So I know how to set up FIXTURE data which is there directly, and I know how to set up the RESTAdapter so I can load/save to the server... can I do both?
It seems like the store gets set up once, for one or the other. Can I have multiple stores, for one data source?
Thanks!
Regardless of which adapter you use, you can always load data directly into the store. For example,
App.Store = DS.Store.extend({
init: function() {
this._super();
this.load(App.Post, {
id: 1,
text: 'Initial post.'
});
}
});
App.Post = DS.Model.extend({
text: DS.attr('string')
});
For a complete example, see this jsfiddle.