Skip to content

Commit a9f2af9

Browse files
authored
Merge pull request #8 from jsonapi-suite/test_for_inclusion
Function to indicate whether a model is marked as manyToMany deleted
2 parents 18baa7b + 2a15619 commit a9f2af9

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

addon/mixins/model.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ export default Ember.Mixin.create({
6969
}
7070
},
7171

72-
manyToManyMarkedForDeletion(relation) {
72+
manyToManyMarkedForDeletion(relation, model) {
73+
return this.get('_manyToManyDeleted') &&
74+
this.get(`_manyToManyDeleted.${relation}`) &&
75+
this.get(`_manyToManyDeleted.${relation}`).includes(model);
76+
},
77+
78+
manyToManyMarkedForDeletionModels(relation) {
7379
const relationModels = this.get('_manyToManyDeleted') &&
7480
this.get(`_manyToManyDeleted.${relation}`);
7581
return relationModels && relationModels.toArray();

addon/mixins/nested-relations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const iterateRelations = function(record, relations, callback) {
1414
let metadata = record.relationshipFor(relationName);
1515
let kind = metadata.kind;
1616
let relatedRecord = record.get(relationName);
17-
let manyToManyDeleted = record.manyToManyMarkedForDeletion(relationName);
17+
let manyToManyDeleted = record.manyToManyMarkedForDeletionModels(relationName);
1818

1919

2020
if (metadata.options.async !== false) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-data-jsonapi-extensions",
3-
"version": "0.5.5",
3+
"version": "0.5.6",
44
"description": "The default blueprint for ember-cli addons.",
55
"directories": {
66
"doc": "doc",

0 commit comments

Comments
 (0)