vendredi 27 février 2015

Difference between using pathForType and inflector.irregular in ember

We can customize the ember pluralization in two ways;



  1. using 'pathForType' in RESTAdapter, like,





App.GroupAdapter = Ember.RESTAdapter.extend({
pathForType: function(type) {
var camelized = Ember.String.camelize(type);
return Ember.String.singularize(camelized);
}
});




  1. 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