ember.js - Ember data - Multiple namespaces for single model -


i have ember data model named activity.

depending on current route, need call services populate store activities different api namespaces. while current activityadapter looks this:

app.activityadapter = ds.restadapter.extend({     namespace: 'services/activities' }); 

i want this:

app.activityadapter = ds.restadapter.extend({     if (this.get('currentroute') === "user") {         namespace: 'services/users/activities'     } else {         namespace: 'services/activities'     } }); 

i can't seem find solution this, , best can think of right hack involves creating separate useractivity model has same properties activity model, , specifying separate useractivityadapter.

has else run issue? input appreciated!

do control api on server? if so, change /services/activities endpoint accept optional userid query param.

so target same namespace:

  • get /services/activities => returns activities
  • get /services/activities?userid=123 => return activities user 123

this common pattern in rest apis. maybe misunderstood problem?


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -