forked from adopted-ember-addons/ember-cp-validations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Async relational validations resolve with fake positive (ado…
- Loading branch information
1 parent
117c8de
commit 5731ab2
Showing
9 changed files
with
6,969 additions
and
30 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,11 +54,12 @@ import { isPromise } from 'ember-cp-validations/utils/utils'; | |
* @extends Base | ||
*/ | ||
const HasMany = Base.extend({ | ||
validate(value) { | ||
validate(value, ...args) { | ||
if (value) { | ||
if (isPromise(value)) { | ||
return value.then((models) => models ? models.map((m) => m.get('validations')) : true); | ||
return value.then((models) => this.validate(models, ...args)); | ||
} | ||
|
||
return value.map((m) => m.get('validations')); | ||
} | ||
|
||
|
@@ -71,7 +72,13 @@ HasMany.reopenClass({ | |
/* | ||
The [email protected] must be added for older ember-data versions | ||
*/ | ||
return [ `model.${attribute}.[]`, `model.${attribute}[email protected]`, `model.${attribute}[email protected]` ]; | ||
return [ | ||
`model.${attribute}.[]`, | ||
`model.${attribute}[email protected]`, | ||
`model.${attribute}[email protected]`, | ||
`model.${attribute}[email protected]`, | ||
`model.${attribute}[email protected]` | ||
]; | ||
} | ||
}); | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
{ | ||
"name": "ember-cp-validations", | ||
"dependencies": { | ||
"jquery": "~2.2.4", | ||
"jquery": "~2.1.4", | ||
"ember": "2.10.0", | ||
"ember-cli-shims": "~0.1.3", | ||
"moment": ">= 2.8.0", | ||
"moment-timezone": ">= 0.1.0", | ||
"font-awesome": "~4.5.0" | ||
}, | ||
"devDependencies": { | ||
"ember-qunit-notifications": "0.1.0" | ||
} | ||
} |
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
Oops, something went wrong.