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!
In Ember Data, an Adapter determines how data is persisted to a backend data store. Things such as the backend host, URL format and headers used to talk to a REST API can all be configured in an adapter. Ember Data's default Adapter has some built-in assumptions about how a REST API should look.
One way to think about the store is as a cache of all of the records that have been loaded by your application. If a route or a controller in your app asks for a record, the store can return it immediately if it is in the cache.
In Ember Data, models are objects that represent the underlying data that your application presents to the user. Note that Ember Data models are a different concept than the model method on Routes, although they share the same name.
Sure, but you still should use find('service').
App.ServiceAdapter = DS.RESTAdapter.extend({
pathForType: function(type) {
var camelized = Ember.String.camelize(type);
return Ember.String.pluralize(camelized);
},
});
App.ServiceAdapter = DS.RESTAdapter.extend({
pathForType: function(type) {
var camelized = Ember.String.camelize(type);
return camelized; //Ember.String.pluralize(camelized);
},
});
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With