mercredi 10 juin 2015

Retrieving rendered json from ember .save() method

My rails backend renders a json response when I call .save() on my model. When doing a jquery ajax PUT request like this, I can retrieve the data returned (see below, data parameter) :

$.ajax({
    type : 'PUT',
    url: '/conversations/' + conversation.id + '/assignation',
    dataType: 'json',
    data: newAssignation,
    success: function(data) {
        conversation.get('content').pushObject(data)};       
});

How can I retrieve rendered json when calling .save() method on my model?

self.store.find('conversation', conv.id).then(function(conversation){

    conversation.set('status', 'opened');
    conversation.save(); ** This returns json response that I want to retrieve **           

});




Aucun commentaire:

Enregistrer un commentaire