Davide Davide - 1 month ago 8
Javascript Question

Extending Ember JSONAPIAdapter findAll for fetching json from custom url

I'm relatively new to Ember.js and I'm trying to studing how ember works and I've this problem:
from an Ember.js route I will call my django api like this:

this.store.findAll('MYMODEL', 'ANOTHER_MODEL_ID')

This findAll will produce an api call like /mymodel/another_model_id/ where another_model_id is a dynamic id (uuid like string).

I've tried to override the findAll method with a custom adapter (mymodel adapter) that extends the ApplicationAdapter (JSONAPIAdapter with a custom buildUrl for adding trailing slash). But my attempt failed, because in findAll overridden method I can't reach the ANOTHER_MODEL_ID parameter. I've also tried to override urlForFindAll and buildUrl methods with the same results.

What is the best method for doing this kind of things and how can I do?


I've resolved using urlForQuery function and declaring my adapter as JSONAPIAdapter extending it with DataAdapterMixin.