I'm having trouble handling server side validations with Ember and Ember Data.
When a validation error occurs, the API returns the code 422. Ember data then triggers the becameInvalid callback on the model.
From here, I'm not sure what's the best way to handle the errors I'm getting, and how to make them bubble up to the view.
App.Challenge = DS.Model.extend Ember.Validations,
title: attr('string')
summary: attr('string')
# other attributes
becameInvalid: (errors) ->
# is it the place where I should handle the errors?
# how would I make the errors bubble up to the view here?
I have 2 issues.
- I'm not sure if
becameInvalidis the place to handle the errors, and if it is, how to make the errors display in the view - In
becameInvalid,@get('isValid')returnstrue, which doesn't make sense to me.