Skip to content

Commit

Permalink
Return fixture relationship IDs if not an object (fix adopted-ember-a…
Browse files Browse the repository at this point in the history
  • Loading branch information
mmelvin0 committed Dec 23, 2015
1 parent e0b74b4 commit 0deface
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addon/jsonapi-fixture-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ var JSONAPIFixtureConverter = function (store) {
relationships[relationship.key] = {data: normalizeJSONAPIAssociation(data, relationship)};
} else if (Ember.typeOf(belongsToRecord) === 'instance') {
relationships[relationship.key] = {data: normalizeJSONAPIAssociation(belongsToRecord, relationship)};
} else {
return belongsToRecord;
}
} else if (relationship.kind === 'hasMany') {
var hasManyRecords = fixture[relationship.key];
Expand All @@ -142,6 +144,8 @@ var JSONAPIFixtureConverter = function (store) {
return normalizeJSONAPIAssociation(data, relationship);
} else if (Ember.typeOf(hasManyRecord) === 'instance') {
return normalizeJSONAPIAssociation(hasManyRecord, relationship);
} else {
return hasManyRecord;
}
});
relationships[relationship.key] = {data: records};
Expand All @@ -154,4 +158,4 @@ var JSONAPIFixtureConverter = function (store) {

};

export default JSONAPIFixtureConverter;
export default JSONAPIFixtureConverter;

0 comments on commit 0deface

Please sign in to comment.