【发布时间】:2009-09-08 07:42:17
【问题描述】:
我的项目中有几个 ActiveResource 模型。当我在 ActiveResource 上调用 to_xml 时,我感到很奇怪。我传递给 to_xml 的选项,例如 :only 和 :except 根本不起作用。在 ActiveRecord 上,它工作得非常好。有谁知道吗?
class Node < ActiveResource::Base
self.site = NODE_SERVER
end
# node has uuid, name, type attributes
node = Node.find("3333")
node.to_xml(:only => [:uuid])
# after here, i still get all attributes
【问题讨论】:
-
to_xml 返回一个 xml 字符串...你对结果做了什么?
-
我会把它发回给客户。
标签: ruby-on-rails activeresource