-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
no issue - `isNew` does not work in Ghost, because Ghost does not use auto increment id's - see bookshelf/bookshelf#1265 - see https://github.com/bookshelf/bookshelf/blob/0.10.3/src/base/model.js#L211 - we only had one occurance, which was anyway redundant - if you add a user, `hasChanged('password') is true - if you edit a user and the password has changed, `hasChanged('password')` is true as well NOTE #1: 1. We can't override `isNew` and throw an error, because bookshelf makes use of `isNew` as well, but it's a fallback if `options.method` is not set. 2. It's hard to re-implement `isNew` based on `options.method`, because then we need to ensure that this value is always set (requires a couple of changes) NOTE #2: If we need to differentiate if a model is new or edited, we should manually check for `options.method === insert`. NOTE #3: The unit tests are much faster compared to the model integration tests. I did a comparision with the same test assertion: - unit test takes 70ms - integration test takes 190ms
- Loading branch information
Showing
3 changed files
with
72 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters