开发者

ruby-on-rails routes problem

开发者 https://www.devze.com 2023-03-27 23:58 出处:网络
I have the following routes: people GET/people(.:format){:action=>\"index\", :controller=>\"people\"}

I have the following routes:

     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"}

However when my flex client calls for update with

" **<mx:HTTPService id = "update"
url='http://localhost:3000/people/{grid.selectedItem.id}.xml?_method=put**"  

I get the error

**ActionController::RoutingError (No route matches "/people/1.xml"**. 

Even when I explicitly (for troubleshooting) convert the line to **url='http://localhost:3000/people/1.xml?_method=put" the error persists.开发者_StackOverflow*

I can type "http://localhost:3000/people/1.xml" in the address bar without error.

What am I doing incorrectly? Thanks in advance.


When you type http://localhost:3000/people/1.xml it is GET request.

You need to make a PUT request which is actually POST http://localhost:3000/people/1.xml?_method=PUT

So you need to make somehow POST request from Flex

0

精彩评论

暂无评论...
验证码 换一张
取 消