Ember.js has built-in support to handle errors returned by the backend through the computed property errors, to get it working with the ActiveModelAdapter you payload’s root key has to be called errors and your status code should be 422.

Suppose you want to create a post and you get an error like the following:

{ errors: { body: ['can't be blank'] } }

Once the requests has been completed you can check if you model is valid or not with model.get('isValid') and then the errors with:

 post.get('errors').get('body')
 [
   Object
   attribute: "body"
   message: "can't be blank"
   __proto__: Object
 ]

Notice that a record becomes isInvalid only if DS.InvalidError can be created, on the ActiveModelAdapter case that is if the status code is 422 and errors is the root of your payload, otherwise it becomes isError.

If you want a validation library checkout DockYard’s ember-validations

P.S I’m writing a series of post on working with Ember.js and Ruby on Rails, subscribe to my list and I will let you know every time I publish an article on Ember.js and Ruby on Rails.

</div>