Reputation: 1606
I am using ember appkit for a beginner ember project. I am working with an existing API and my model looks as such:
export default Ember.Route.extend({
model: function(){
return this.store.find('prequalification');
}
});
When the API call happens, the URL is pluralized, prequalifications. I am trying to configure the RestAdapter but not sure where in the code flow this should happen.
Thanks for any help
Upvotes: 0
Views: 138
Reputation: 15576
Irregular or uncountable pluralizations can be specified via Ember.Inflector.inflector
:
Ember.Inflector.inflector.irregular('formula', 'formulae');
Ember.Inflector.inflector.uncountable('advice');
This will tell the REST adapter that requests for App.Formula requests should go to /formulae/1
instead of /formulas/1
.
REF : http://emberjs.com/guides/models/the-rest-adapter/#toc_pluralization-customization
Upvotes: 1
Reputation: 1686
It happens in the RestAdapter, you're correct...
check the pathForType attribute out out:
Their example is:
DS.RESTAdapter.reopen({
pathForType: function(type) {
var decamelized = Ember.String.decamelize(type);
return Ember.String.pluralize(decamelized);
};
});
Upvotes: 0