首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ruby-on-rails路由问题

ruby-on-rails路由问题
EN

Stack Overflow用户
提问于 2011-08-15 22:49:12
回答 1查看 138关注 0票数 1

我有以下几条路线:

代码语言:javascript
复制
     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客户端使用

代码语言:javascript
复制
" **<mx:HTTPService id = "update"
url='http://localhost:3000/people/{grid.selectedItem.id}.xml?_method=put**"  

我得到了错误

代码语言:javascript
复制
**ActionController::RoutingError (No route matches "/people/1.xml"**. 

即使我显式地(为了故障排除)将行转换为**url='http://localhost:3000/people/1.xml?_method=put",错误仍然存在。*

我可以在地址栏中键入"http://localhost:3000/people/1.xml"而不会出错。

我做错了什么?提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2011-08-15 22:57:05

当您键入http://localhost:3000/people/1.xml时,它是GET request。

您需要发出一个实际为POST http://localhost:3000/people/1.xml?_method=PUTPUT请求

因此您需要以某种方式从Flex发出POST请求

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7066367

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档