ember.js - Emberjs - how to remove pluralization of URLs? -


i building emberjs app , want call rest api results. have code:

app.post = ds.model.extend(); app.postadapter = ds.restadapter.extend({        namespace: 'api/v1',     host: 'http://myapp.com' }); 

and in controller have this

post: this.store.find('post') 

the problem calls "s" added in end, example - http://myapp.com/api/v1/posts

how remove plural form these calls?

you need override pathfortype method in adapter.

   app.postadapter = ds.restadapter.extend({         pathfortype: function(type) {        var camelized = ember.string.camelize(type);        return ember.string.singularize(camelized);      }    }); 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -