需要帮助Ember-Data与Zend Rest合作.
起初,我熟悉Zend Framework,因此Rest Adapter很容易设置.telnet的请求显示它有效,响应也有格式良好的HTTP代码.
使用Ember Data的设置稍微复杂一些.我安装了一个带Ubuntu的虚拟机,安装了Ruby 1.9.3,git clone编写了ember-data存储库并用rake生成了JS文件.我还安装了bundler来解决所有依赖项.似乎工作没有错误.这对我来说是第一次.我不熟悉红宝石.
不幸的是,它似乎没有起作用.在我的测试应用程序上,我看到了firebug的其余请求.回应看起来也不错.但对象仍然是空的.
响应:
[{"id":"1","user":"testuser","password":"123","mail":"my@me.com","role":"GUEST","active":"1","hash":null,"last_login":null}]
Run Code Online (Sandbox Code Playgroud)
响应标头:
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection Keep-Alive
Content-Encoding gzip
Content-Length 121
Content-Type application/json; charset=utf-8
Date Wed, 20 Jun 2012 10:49:38 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive timeout=15, max=99
Pragma no-cache
Server Apache
Vary Accept-Encoding
X-Powered-By PHP/5.3.13
X-UA-Compatible IE=Edge,chrome=1
Run Code Online (Sandbox Code Playgroud)
我的应用:
// my script
App = Em.Application.create();
App.store = DS.Store.create({
revision: 4,
adapter: DS.RESTAdapter.create({ bulkCommit: false, namespace: 'rest' })
});
App.User = DS.Model.extend({ …Run Code Online (Sandbox Code Playgroud)