mardi 29 mars 2016

Ember - Customize adapter not to use model name

I would like to ask a question about ember model and adapter. I have a model named account, used user creation. I would like not to use the model name in the url but when I try to create a user and communicate with the backend (http://ift.tt/1RMM3mT), ember keeps trying to connect to http://ift.tt/22WVRfC.

In the application RESTAdapter:

I have declare:

and my buildURL is shown below:

buildURL: function(modelName, id, snapshot, requestType, query) {

    var url = this._super(modelName, id, snapshot, requestType, query);

    if (requestType == "createRecord" && modelName == "account")  {
        url = url + "register/"
    }

    return url;
}




Aucun commentaire:

Enregistrer un commentaire