我的项目中有几个 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