api-hogs/ember-data-offline

Offline Mixin to extend ActiveModelAdapter

Closed this issue · 2 comments

Hi,

I am using Active-Model-Adapter (https://github.com/ember-data/active-model-adapter) with Ember-Data, therefore I do not want to extend my application adapter with baseAdapter from ember-data-offline.
Is there a way how can I include some mixin that will extend my application adapter like the following:

export default ActiveModelAdapter.extend(OfflineAdapterMixin, {
...
});

Will appreciate any help. Thanks!

Hi!
Sure you can. For right now, you need to do just everything that we did in baseAdapter, but for ActiveModelAdapter. This can be achieved in many ways. The easiest is to just copy baseAdapter and replace RESRAdapter with AM.
The main points of baseAdapter are - to link onlineAdapter and offlineAdapter, to pass some offlineSerializer params(https://github.com/api-hogs/ember-data-offline/blob/master/addon/adapters/base.js#L76) and to setup container for them. So you can do this points in the most comfortable way for you and it will be working.
For next releases we'll add more flexible adapters/serializer definition system, but for now you should do some manual work.

@igorpreston any success with this?