2010-07-16 95 views
2

我有一个应用程序App2我发送POSTApp1请求使用ActiveResource自定义的URL来自ActiveResource命中

App1, 我

module App2 
    class Iteeem # Purposely misspelled here 
     def self.edit_item 
      self.prefix "/api/editing_item/" 
      post :item, {:property => {:value => 5665}} 
     end 
    end 
end 

它击中

http://app2.mydomain.com/api/editing_item/iteeems/item.xml 

(现在你知道为什么我拼错吧)

但我想将它打

http://app2.mydomain.com/api/editing_item/item.xml 

请指教。

回答

3

好吧,我发布了这一瞬间后得到它! 只需更换尾随斜线

更换

self.prefix "/api/editing_item/" 

self.prefix "/api/editing_item" 

,并添加

self.element_name "" 

希望这可以帮助别人...