Skip to content

Commit

Permalink
Merge pull request genkgo#40 from sebweaver/master
Browse files Browse the repository at this point in the history
Ember Data 2.0 compatibility (genkgo#39)
  • Loading branch information
frederikbosch committed Sep 12, 2015
2 parents ccc6b01 + 304b788 commit 4b10199
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions addon/serializers/localforage.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ export default DS.JSONSerializer.extend({
delete payload._embedded;
}

// Remove the undefined hasMany relationships which will fail at normalization
// (see https://github.com/emberjs/data/issues/3736)
var relationshipNames = Ember.get(primaryModelClass, 'relationshipNames');
var relationships = relationshipNames.hasMany;

relationships.forEach((relationName) => {
if (Ember.isNone(payload[relationName])) {
delete payload[relationName];
}
});

return payload;
},
});
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"dependencies": {
"jquery": "^1.11.1",
"localforage": "~1.2.1",
"ember": "^1.13.x",
"ember-data": "^1.13.x",
"ember": "2.0.x",
"ember-data": "2.0.x",
"ember-resolver": "~0.1.14",
"loader.js": "ember-cli/loader.js#3.3.0",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.5",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"glob": "^4.0.5",
"ember-cli-qunit": "1.0.1",
"ember-cli-uglify": "1.0.1",
"ember-data": "^1.13.x"
"ember-data": "2.0.x"
},
"description": "Store your ember application data in Mozilla's localforage.",
"keywords": [
Expand Down

0 comments on commit 4b10199

Please sign in to comment.