开发者

Customize the URL hit from ActiveResource

I have an application App2 to which I am sending a POST request from App1 using ActiveResource.

On the App1, I have

module App2
    class Iteeem # Purposely mis开发者_开发问答spelled here
        def self.edit_item
            self.prefix "/api/editing_item/"
            post :item, {:property => {:value => 5665}}
        end
    end
end

It hits

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

(Now you know why I misspelt it)

But I want it to hit

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

Please advice.


Well, got it moments after I posted this! Just replace the trailing slash

replace

self.prefix "/api/editing_item/"

with

self.prefix "/api/editing_item"

and add

self.element_name ""

Hope this helps someone...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜