Using DS.FixtureAdapter and DS.RESTAdapter at the same time

后端 未结 3 1426
星月不相逢
星月不相逢 2021-01-14 11:08

I would like to use both adapters, depending on the route. Currently I have the following store:

if (window.USE_FIXTURES) { var my_adapter = \'DS.FixtureAdap         


        
3条回答
  •  走了就别回头了
    2021-01-14 11:22

    @intuitivepixel's answer no longer works in current day Ember (v1.0+); as registerAdapter no longer exists in the API.

    Nowadays you can just declare an Adapter for each model where you want to override the adapter choice:

    App.LegacyModel = DS.Model.extend({
        name: DS.attr('string'),
    });
    
    App.LegacyAdapter = DS.FixtureAdapter;
    

提交回复
热议问题