我有以下配置:
window.App = Ember.Application.create();
DS.RESTAdapter.reopen({
host: 'https://localhost:3000/api/v1',
});
App.Store = DS.Store.extend({
revision: 11,
adapter: DS.RESTAdapter
});
但我试图呼叫的网址是http://localhost:3000/api/v1/balance
,但Ember最后称之为“余额”。有没有办法为此指定复数?谢谢!
答案 0 :(得分:3)
这是旧的,应该删除,https://github.com/emberjs/data/blob/master/TRANSITION.md
App.Store = DS.Store.extend({
revision: 11,
adapter: DS.RESTAdapter
});
您可以像这样定义适配器
对于应用程序级适配器
App.ApplicationAdapter = DS.RESTAdapter;
对于特定型号适配器
App.BalanceAdapter = DS.RESTAdapter.extend({
pathForType: function(type) {
var decamelized = Ember.String.decamelize(type);
//return Ember.String.pluralize(decamelized);
return decamelized;
}
});