mercredi 24 août 2016

Model name with hyphen cannot be typed in ember route

I have a model named phone-session in ember and I am using the DRF underscore adapter to transform dash to underscore since the endpoint is

/v1/phone_session/

I am trying to return a dynamic segment model, as seen below

   model:function(params){
     return Ember.RSVP.hash({
       phone: this.store.findRecord('phone-session',params.phone-session_id),
       numbers: this.store.findAll('number')
     });
    }

unfortunately this is not working since ember is only reading session_id instead of phone-session_id and returning the error:

ember.debug.js:32096 ReferenceError: session_id is not defined

this is cause due to naming convetions that I cannot change now since my endpoints are named that way.

what can I do to solve this problem ?




Aucun commentaire:

Enregistrer un commentaire