# willCommit in invalid state

**URL:** <https://discuss.emberjs.com/t/willcommit-in-invalid-state/3291>\
**Category:** Ember Data\
**Created:** [November 8, 2013, 11:23pm UTC](https://discuss.emberjs.com/t/willcommit-in-invalid-state/3291 "2013-11-08T23:23:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheldonnbbaker](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/sheldonnbbaker/32/5044_2.png) [@sheldonnbbaker](https://discuss.emberjs.com/u/sheldonnbbaker)\
**Post date:** [November 8, 2013, 11:23pm UTC](https://discuss.emberjs.com/t/willcommit-in-invalid-state/3291/1 "2013-11-08T23:23:28Z")

</div>

The docs describe the invalid state as follows:

> the record has invalid information and cannot send to the adapter yet.

A user in the app I’m building needs to be able to `save` a record again even if it has recently come back from the server as invalid (some properties are not editable by the user and so the record in some cases can’t become valid again via `invalid.didSetProperty`).

I’ve added the following to the invalid state and haven’t come across any problems yet, but does anyone know if there are any edge cases where this might present a problem?

`willCommit: function(record) { record.transitionTo('inFlight'); },`

`record.transitionTo('uncommitted')` apparently works as well but is a bit more tedious and seems like it would be more destructive than the first way.

---

<div class="post-metadata">

**Author:** ![samg](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/samg/32/15206_2.png) [@samg](https://discuss.emberjs.com/u/samg)\
**Post date:** [November 9, 2013, 8:09am UTC](https://discuss.emberjs.com/t/willcommit-in-invalid-state/3291/2 "2013-11-09T08:09:20Z")

</div>

I’ve done this by calling model.send(“becameValid”) in the failure callback to save. I’m also curious about the “correct” approach here.

---

<div class="post-metadata">

**Author:** ![dmarkow](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dmarkow/32/15070_2.png) [@dmarkow](https://discuss.emberjs.com/u/dmarkow)\
**Post date:** [February 19, 2014, 3:50pm UTC](https://discuss.emberjs.com/t/willcommit-in-invalid-state/3291/3 "2014-02-19T15:50:02Z")

</div>

Sending `becameValid` used to work for me in older version of ember-data, but not anymore.

Recent versions of ember-data add an `errors` attribute (using `DS.Errors`) to each record. Clearing out these errors before resubmitting works for me.

```auto
model.get("errors").clear()
model.save()

```
