Removed taking care of bookshelf's changed model keys

no issue

- this is no longer needed for now
- it was anyway a little bit ugly to modify bookshelf's `changed` object
- if we want to change something about figuring out if a model has changed (including relations)
  -> we probably need to override bookshelf
This commit is contained in:
kirrg001 2018-04-05 16:24:35 +02:00 committed by Katharina Irrgang
parent 853b518a51
commit da80019aca

View File

@ -180,18 +180,6 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
this.attributes = this.pick(this.permittedAttributes());
// Store the previous attributes so we can tell what was updated later
this._updatedAttributes = newObj.previousAttributes();
/**
* Bookshelf keeps none valid model attributes in `model.changed`. This causes problems
* when detecting if a model has changed. Bookshelf detects changed attributes too early.
* So we have to manually remove invalid model attributes from this object.
*
* e.g. if you pass `tag.parent` into the model layer, but the value has not changed,
* the attribute (`tag.parent`) is still kept in the `changed` object. This is wrong.
*
* TLDR; only keep valid model attributes in the changed object
*/
this.changed = _.pick(this.changed, Object.keys(this.attributes));
},
/**