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
Post a Comment