javascript - Why does Ember Data think save() is failing when it’s not? -
i have ember model saving database. when call
model.save().then(function () { alert('everything worked.'); }, function () { alert('save failed.'); });
the record persists database, network request api call saving responds status code of 200 , body of
{ "id": 11, "send_date": "2014-12-01t23:20:31.821z", "expiration_date": "2014-12-08t06:00:00.000z", "message": "what happening here", "url": null, "feature_id": null }
and no errors appear in console. works perfectly, except rejection handler alert('save failed.')
called every time. success handler never called. why?
edit
the reason
passed fail handler error:
column: 22 line: 11256 message: "undefined not object (evaluating 'factory.typekey')" sourceurl: "http://localhost:8080/bower_components/ember-data/ember-data.js" stack: "modelfor@http://localhost:8080/bower_components/ember-data/ember-data.js:11256:22 recordforid@http://localhost:8080/bower_components/ember-data/ember-data.js:10727:33 deserializerecordid@http://localhost:8080/bower_components/ember-data/ember-data.js:11692:38 http://localhost:8080/bower_components/ember-data/ember-data.js:11670:30 http://localhost:8080/bower_components/ember-data/ember-data.js:9456:24 http://localhost:8080/bower_components/ember-data/ember-data.js:5295:37 http://localhost:8080/bower_components/ember/ember.js:14899:24 foreach@http://localhost:8080/bower_components/ember/ember.js:14741:18 foreach@http://localhost:8080/bower_components/ember/ember.js:14897:21 mapforeach@http://localhost:8080/bower_components/ember-data/ember-data.js:5302:29 eachrelationship@http://localhost:8080/bower_components/ember-data/ember-data.js:9455:49 normalizerelationships@http://localhost:8080/bower_components/ember-data/ember-data.js:11666:28 didsaverecord@http://localhost:8080/bower_components/ember-data/ember-data.js:11125:40 http://localhost:8080/bower_components/ember-data/ember-data.js:11905:28 trycatch@http://localhost:8080/bower_components/ember/ember.js:45817:24 invokecallback@http://localhost:8080/bower_components/ember/ember.js:45829:25 publish@http://localhost:8080/bower_components/ember/ember.js:45800:25 http://localhost:8080/bower_components/ember/ember.js:29071:17 invoke@http://localhost:8080/bower_components/ember/ember.js:634:22 flush@http://localhost:8080/bower_components/ember/ember.js:684:21 end@http://localhost:8080/bower_components/ember/ember.js:147:32 run@http://localhost:8080/bower_components/ember/ember.js:202:23 apply@http://localhost:8080/bower_components/ember/ember.js:18384:31 run@http://localhost:8080/bower_components/ember/ember.js:17001:19 success@http://localhost:8080/bower_components/ember-data/ember-data.js:1879:24 fire@http://localhost:8080/bower_components/jquery/jquery.js:2913:35 firewith@http://localhost:8080/bower_components/jquery/jquery.js:3025:11 done@http://localhost:8080/bower_components/jquery/jquery.js:7400:25 http://localhost:8080/bower_components/jquery/jquery.js:7822:17"
edit
i fixed error removing belongsto
relationship ember data model. relationship feature going implement later, i'm removing now. guess cross bridge when it.
Comments
Post a Comment