diff --git a/README.md b/README.md index 9ee2f5ad..9226192c 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,6 @@ npm version Ember Observer Score -To install: - ``` ember install ember-changeset ``` @@ -17,7 +15,7 @@ ember install ember-changeset ## Updates -We have released a v2.0.0-beta. This includes a solution for deeply nested sets with one big caveat. Some history - Post v1.3.0, there was an elegant solution proposed and implemented for deeply nested sets - e.g. `changeset.set('profile.name', 'myname')`. However, this caused many issues and was reverted in v2.0.0-beta. Since `ember-changeset` relies on [Proxy](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy) like behaviour, we are able to trap `changeset.set(...` and properly handle nested sets. This, however, is a problem in templates where `mut changeset.profile.name` is implicitly `set(changeset, 'profile.name')`, thus subverting our trap. This is the caveat with the v2.0.0-beta release. Although it is an improvement over v1.3.0 and should be 1-1 behaviour if you are setting at a single level - e.g. `mut changeset.name` -, nested setters don't have an ideal solution. So we are releasing v2.0.0-beta with this caveat and adding a `changeset-set` helper to use in templates. This is a work in progress. +We have released `v2.0.0-beta`. This includes a solution for deeply nested sets with one big caveat. Some history - Post v1.3.0, there was an elegant solution proposed and implemented for deeply nested sets - e.g. `changeset.set('profile.name', 'myname')`. However, this caused many issues and was reverted in v2.0.0-beta. Since `ember-changeset` relies on [Proxy](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy) like behaviour, we are able to trap `changeset.set(...` and properly handle nested sets. This, however, is a problem in templates where `mut changeset.profile.name` is implicitly `set(changeset, 'profile.name')`, thus subverting our trap. This is the caveat with the v2.0.0-beta release. Although it is an improvement over v1.3.0 and should be 1-1 behaviour if you are setting at a single level - e.g. `mut changeset.name` -, nested setters don't have an ideal solution. So we are releasing v2.0.0-beta with this caveat and adding a `changeset-set` template helper. This is a work in progress. ## Philosophy @@ -124,6 +122,19 @@ In the above example, when the input changes, only the changeset's internal valu On rollback, all changes are dropped and the underlying Object is left untouched. +## Changeset template helper +`ember-changeset` overrides `set` in order to handle deeply nested setters. `mut` is simply an alias for `set(changeset`, thus we provide a `changeset-set` template helper. + +```hbs +
+ +
+``` + ## Disabling Automatic Validation The default behavior of `Changeset` is to automatically validate a field when it is set. Automatic validation can be disabled by passing `skipValidate` as an option when creating a changeset.