My application embeds initial data into the html so that Ember does not need to send extra http requests on initialization. I am using the latest Ember data and I have not been able to succesfully take a JSON object, which is the same as Active Model Serializer returns when you save or create a record, and load it into the store.
I am currently trying these methods with no success:
In a route -
this.get('store').load(App.Post, data)
and
this.get('store').loadMany(App.Post, data)
I also use Pusher that sends me the JSON (generated by Active Model Serializer) for an updated object and the callback in my route currently looks like this.
refresh: function(data) {
var json = data
var store = this.get('store')
var type = App.Post
var id = data.reply.id
Ember.run(this, function(){
store.adapterForType(App.Post).didFindRecord(store, type, json, id);
});
}
Has anyone successfully done this? I know Discourse is not using Ember Data so their solution is different. I really appreciate any help in the matter. Thanks