We can customize the ember pluralization in two ways;
- using 'pathForType' in RESTAdapter, like,
App.GroupAdapter = Ember.RESTAdapter.extend({
pathForType: function(type) {
var camelized = Ember.String.camelize(type);
return Ember.String.singularize(camelized);
}
});
- By using Ember.inflector.irregular() in model
Ember.inflector.irregular('group', 'group');
In both case it will make a call to 'group' instead of 'groups'. Is there any difference between both? which one to use?
Aucun commentaire:
Enregistrer un commentaire