我正在尝试通过以下方式在 flex 和 rails 之间进行更新:
// TODO Auto-generated method stub
var strXml:XML = <test>
<test_id>{txtMarketId.text}</test_id>
<market_name>{txtMarketName.text}</market_name>
</test>;
req = new URLRequest("http://localhost:3000/tests/"+market_id);
jrwloader = new URLLoader();
params = new URLVariables();
req.data = strXml.toString();
req.method = URLRequestMethod.POST;
req.requestHeaders.push(new URLRequestHeader("X-HTTP-Method-Override", URLRequestMethod.PUT));
jrwloader.load(req);
在我的 Rails 应用程序中,我得到了这个:
Started PUT "/markets/2" for 10.10.10.10 at 2012-09-08 18:37:24 +0000
Processing by TestController#update as */*
Parameters: {"test_id:2, market_name:test"=>nil, "id"=>"2"}
WARNING: Can't verify CSRF token authenticity
Market Load (0.2ms) SELECT `tests`.* FROM `test` WHERE `test`.`test_id` = 2 LIMIT 1
(0.1ms) BEGIN
(0.1ms) COMMIT
Redirected to http://localhost:3000/tests/2
Completed 302 Found in 3ms (ActiveRecord: 0.4ms)
我想我已经接近答案了,但我无法将新数据设置到数据库中。