[Answer]-What RESTAdapter expects on server responses and what requests should server expect?

1👍

Generally you should be able to see the requests Ember makes by just opening your browser dev tools and seeing the network requests.

Ember data likes the api to respond with an errors hash, something like this:

{"errors":{"title":["can't be blank"]}}

Then as long as you define a function to handle the error case:

Ember.Controller.extend({
  actions: {
    deleteUser: function() {
      var user = this.model;
      function success() {
        // do something cool? 
      }

      function failure() {
        user.rollback();    
      }

      user.destroyRecord().then(success, failure);
    }
  }
});

then user.errors will be automatically populated and you can do an if user.errors in your template.

Leave a comment