Skip to content

Commit 4426d09

Browse files
committed
Removing dashed path support
1 parent c16a3ca commit 4426d09

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/json-api-adapter.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ DS.JsonApiAdapter = DS.RESTAdapter.extend({
8989
* Suppress additional API calls if the relationship was already loaded via an `included` section
9090
*/
9191
findBelongsTo: function(store, snapshot, url, relationship) {
92-
var belongsTo = snapshot.belongsTo(relationship.key),
93-
belongsToLoaded = belongsTo && !belongsTo.record.get('currentState.isEmpty');
92+
var belongsTo = snapshot.belongsTo(relationship.key);
93+
var belongsToLoaded = belongsTo && !belongsTo.record.get('currentState.isEmpty');
9494

9595
if(belongsToLoaded) { return; }
9696

@@ -113,18 +113,18 @@ DS.JsonApiAdapter = DS.RESTAdapter.extend({
113113
* and match the root key to the route
114114
*/
115115
updateRecord: function(store, type, snapshot) {
116-
var data = this._serializeData(store, type, snapshot),
117-
id = get(snapshot, 'id');
116+
var data = this._serializeData(store, type, snapshot);
117+
var id = get(snapshot, 'id');
118118

119119
return this.ajax(this.buildURL(type.typeKey, id, snapshot), 'PUT', {
120120
data: data
121121
});
122122
},
123123

124124
_serializeData: function(store, type, snapshot) {
125-
var serializer = store.serializerFor(type.typeKey),
126-
pluralType = Ember.String.pluralize(type.typeKey),
127-
json = {};
125+
var serializer = store.serializerFor(type.typeKey);
126+
var pluralType = Ember.String.pluralize(type.typeKey);
127+
var json = {};
128128

129129
json.data = serializer.serialize(snapshot, { includeId: true });
130130
if(!json.data.hasOwnProperty('type')) {
@@ -170,7 +170,7 @@ DS.JsonApiAdapter = DS.RESTAdapter.extend({
170170

171171
pathForType: function(type) {
172172
var decamelized = Ember.String.decamelize(type);
173-
return Ember.String.pluralize(decamelized).replace(/_/g, '-');
173+
return Ember.String.pluralize(decamelized);
174174
}
175175
});
176176

tests/integration/specs/urls-for-resource-collections-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ asyncTest('GET /posts/1 calls later GET /comments/2,3 when Posts has async comme
9292
});
9393
});
9494

95-
asyncTest('GET /some-resource, not camelCase, dasherized', function() {
95+
asyncTest('GET /some_resource, not camelCase, dasherized', function() {
9696
var models = setModels({
9797
commentAsync: true
9898
});
9999
env = setupStore(models);
100100

101-
fakeServer.get('/some-resources/1', responses.underscore_resource);
101+
fakeServer.get('/some_resources/1', responses.underscore_resource);
102102

103103
Em.run(function() {
104104
env.store.find('someResource', '1').then(function(record) {

0 commit comments

Comments
 (0)