I have a global custom Adapter:
// app/adapters/application.js
import ActiveModelAdapter from 'active-model-adapter';
export default ActiveModelAdapter.extend({
namespace: 'api',
host: 'http://ift.tt/1SbiS8C'
});
And another specific for one Model:
// app/adapters/chart.js
import ActiveModelAdapter from 'active-model-adapter';
export default ActiveModelAdapter.extend({
namespace: 'api',
host: 'http://ift.tt/1SbiS8C',
buildURL: function(type, id, snapshot) {
return this.host + '/' + this.namespace + '/reports/' + snapshot.record.get('report.id') + '/charts/' + id;
}
});
As you can see there is a duplication defining the attributes 'namespace' and 'api'. This is one of the reasons I'm trying to inherit the ChartsAdapter from the ApplicationAdapter.
Aucun commentaire:
Enregistrer un commentaire