How to make Ember data stop changing my endpoints to singular and plural according to its rules?
ember-data, ember.js, javascript, rest, web
Solution
Sure, but you still should use find('service').
Plural (this is the default implementation)
App.ServiceAdapter = DS.RESTAdapter.extend({
pathForType: function(type) {
var camelized = Ember.String.camelize(type);
return Ember.String.pluralize(camelized);
},
});
Singular
App.ServiceAdapter = DS.RESTAdapter.extend({
pathForType: function(type) {
var camelized = Ember.String.camelize(type);
return camelized; //Ember.String.pluralize(camelized);
},
});
Base Singular Class
App.BaseSingularAdapter = DS.RESTAdapter.extend({
pathForType: function(type) {
var camelized = Ember.String.camelize(type);
return camelized; //Ember.String.pluralize(camelized);
},
});
Both Foo and Bar would be singular using the code below
App.FooAdapter = App.BaseSingularAdapter;
App.BarAdapter = App.BaseSingularAdapter;
Problem
I need Ember to stop trying to guess things when making calls to the REST endpoints, but can't find a way do do so. If I have an endpoint say, `/services`, I want ember to always call `/services` regardless if I'm making a call to `find('services')` or `find('services', 1)` Same for singulars. Is it possible to disable this behavior? Even if I have to override methods in the REStAdapter that'd be OK. Thanks!