Closed chripede closed 10 years ago
It seems like this actually broke the build - could you give that test a look and see if you can modify this? also -could you provide a true test case to show this in action? thanks !
@toranb I fixed the test. As you can see from the new speaker template it's now possible to display the exact field that causes the PUT request to fail.
Is it possible to bind the errors to their respective model attributes?
e.g.:
<form>
<!-- non-field errors -->
<div>{{#each errors}}{{this}}{{/each}}</div>
<!-- field errors -->
<div>{{#each location.errors}}{{this}}{{/each}}</div>
{{input value=location}}
</form>
@dustinfarris It might be possible, but I don't think it should be done that way.
Hmm, I'm not sure about the "ember" way. That adapter looks like it was specifically written for Ruby on Rails. As for the second concern, could we have a raw output property or something?
It's using DS.InvalidError from Ember-data. http://emberjs.com/api/data/classes/DS.InvalidError.html
The DS.InvalidError must be constructed with a single object whose keys are the invalid model properties, and whose values are the corresponding error messages.
If you want the errors on each model property I think that's something you should do yourself in the error callback from the save function.
Good point. It is good the way it is then.
This makes it possible to handle server side errors on the client side.
Function was copied from the ActiveModelAdapter (https://github.com/emberjs/data/blob/v1.0.0-beta.8/packages/activemodel-adapter/lib/system/active_model_adapter.js#L102) and modified to work with DRF.