Returns the serialized string representation of the resource in the
configured serialization format specified in
ActiveResource::Base.format. The options applicable depend on the
configured encoding format.
# File activeresource/lib/active_resource/base.rb, line 974
def encode(options={})
case self.class.format
when ActiveResource::Formats[:xml]
self.class.format.encode(attributes, {:root => self.class.element_name}.merge(options))
when ActiveResource::Formats::JsonFormat
if ActiveResource::Base.include_root_in_json
self.class.format.encode({self.class.element_name => attributes}, options)
else
self.class.format.encode(attributes, options)
end
else
self.class.format.encode(attributes, options)
end
end