我有以下路线:
people GET /people(.:format) {:action=>"index", :controller=>"people"}
POST /people(.:format) {:action=>"create", :controller=>"people"}
new_person GET /people/new(.:format) {:action=>"new", :controller=>"people"}
edit_person GET /people/:id/edit(.:format) {:action=>"edit", :controller=>"people"}
person GET /people/:id(.:format) {:action=>"show", :controller=>"people"}
**PUT /people/:id(.:format) {:action=>"update", :controller=>"people"}**
DELETE /people/:id(.:format) {:action=>"destroy", :controller=>"people"}
然而,当我的flex客户端使用
调用更新时" **<mx:HTTPService id = "update"
url='http://localhost:3000/people/{grid.selectedItem.id}.xml?_method=put**"
我收到错误
**ActionController::RoutingError (No route matches "/people/1.xml"**.
即使我明确(用于排查)将行转换为**url='http://localhost:3000/people/1.xml?_method=put"
,错误仍然存在。*
我可以在地址栏中输入"http://localhost:3000/people/1.xml"
而不会出错。
我做错了什么?提前谢谢。
答案 0 :(得分:2)
当您输入http://localhost:3000/people/1.xml
时,它是GET请求。
您需要提出PUT
实际为POST http://localhost:3000/people/1.xml?_method=PUT
所以你需要从Flex
以某种方式提出POST
请求