Skip to content

Commit b15b7c6

Browse files
committed
Fixing some code-styling issues and huge issue on custom-named belongsTo relations
1 parent 023899a commit b15b7c6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

addon/serializers/application.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,25 +148,24 @@ export default DS.RESTSerializer.extend({
148148
}
149149
},
150150

151-
serializeBelongsTo: function( snapshot, json, relationship ) {
151+
serializeBelongsTo: function(snapshot, json, relationship) {
152152
var key = relationship.key,
153153
belongsToId = snapshot.belongsTo(key, { id: true });
154154

155-
if ( belongsToId ) {
155+
if (belongsToId) {
156156
json[key] = {
157157
'__type' : 'Pointer',
158-
'className' : this.parseClassName(key),
158+
'className' : this.parseClassName(relationship.type.typeKey),
159159
'objectId' : belongsToId
160160
};
161161
}
162162
},
163163

164-
parseClassName: function( key ) {
165-
if ( 'parseUser' === key) {
164+
parseClassName: function(key) {
165+
if ('parseUser' === key) {
166166
return '_User';
167-
168167
} else {
169-
return Ember.String.capitalize( Ember.String.camelize( key ) );
168+
return Ember.String.capitalize(Ember.String.camelize(key));
170169
}
171170
},
172171

0 commit comments

Comments
 (0)