spacerobot
spacerobot

Reputation: 297

Ember how to use multiple adapters?

I have an ember app that hooks into a rails-api. I am using devise for authentication and have an application.js adapter set up for the authorization. Now I want to connect to my rails DB model and display some data. I need to add the ActiveModelAdapter to connect. How do I add in a second ActiveModelAdapter so I can use it? I'm just getting started with Ember so I wasn't sure.

    import DS from 'ember-data';
    import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
    import ActiveModelAdapter from 'active-model-adapter';

    export default DS.JSONAPIAdapter.extend(DataAdapterMixin, {
      authorizer: 'authorizer:devise'
    });

Upvotes: 0

Views: 334

Answers (1)

fidlip
fidlip

Reputation: 71

There is no exact need to create another adapter if you will handle requests at server side the same way. All you really need is to create model which corresponds to payload from server. You will need to create another one adapter only if something differs.

Upvotes: 1

Related Questions