rest - Ember js RESTAdapter PUT request adds .json to the end -


i've been trying learn ember , have question.

in store i'am getting data .json below. have tried without buildurl function cant load json file, found solution on so.

cocktailapp.store = ds.store.extend({ revision: 12, adapter: ds.restadapter.extend({     bulkcommit: false,      url: "http://localhost:8888",         buildurl: function(record, suffix) {         var s = this._super(record, suffix);         return s + ".json";     }  }) }); 

now comes question: when commit chances (by pressing add favs or remove favs) restadapter adds ".json" @ end of put request. see below code , screenshot

cocktailapp.cocktailcontroller = ember.objectcontroller.extend({ addtofav: function () { this.set('fav',true); this.get('store').commit(); }, removefromfav: function () { this.set('fav',false); this.get('store').commit(); }  }); 

enter image description here

i think thats why put request can not handled. if remove builturl function no json loaded @ all. how can resolve problem? thanks

if api endpoint url not require .json @ end of it, remove line buildurl function. guess example code got consuming ruby on rails api, or similar.

remember, when send get, put, post, or delete url, url needs real endpoint. can't add extraneous stuff , have still work.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -