我已经设置了一个测试,我尝试在获取项目后放置它。但是,它在 PUT 的日期失败。下面的日期字段使用 DS.attr('date')。
版本:
Ember : 1.1.1
Ember Data : 1.0.0-beta.4+canary.c15b8f80
Handlebars : 1.0.0
jQuery : 1.9.1
这是我的代码:
建筑物控制器
App.BuildingsController = Ember.Controller.extend({
actions: {
createBuilding: function() {
var store = this.get('store');
store.find('building', 1729).then(function(building) {
building.set('title', 'Test 123');
building.save();
});
}
}
});
调用 store.find 时 API 返回的数据:
{
"building":{
"id":"1729",
"name":"Test 123",
"sort":"1",
"published_at":"2013-09-26 11:00:27",
"source":"source test",
"content":"<p>content test<\/p>",
"excerpt":"<p>excerpt test<\/p>",
"lat":"62.39039989300704",
"lon":"17.341790199279785",
"address":"address",
"build_start":"2013-09-22",
"build_end":"2013-09-23",
"created_at":"2013-09-26 11:00:28",
"updated_at":"2013-09-26 11:00:28"
}
}
数据 PUT 到 API:
{
"address" : "address",
"build_end" : "Mon, 23 Sep 2013 00:00:00 GMT",
"build_start" : "Sun, 22 Sep 2013 00:00:00 GMT",
"content" : "<p>content test</p>",
"created_at" : "undefined, NaN undefined NaN NaN:NaN:NaN GMT",
"excerpt" : "<p>excerpt test</p>",
"lat" : 62.39039989300704,
"lon" : 17.341790199279785,
"name" : "Test 123",
"published_at" : "undefined, NaN undefined NaN NaN:NaN:NaN GMT",
"sort" : 1,
"source" : "source test",
"updated_at" : "undefined, NaN undefined NaN NaN:NaN:NaN GMT"
}