You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's assume I have a collection with different object classes (STI). For example, I have a "Whoot" base class and "ReWhoot" as subclass and my API returns both Whoots and Rewhoots in a single collection.
But actually second object is instance of Whoot and it will be nice to output this node as
<whoot>..</whoot>
options[:root_name] is calculated only once and used for any object
def compile_hash(options={})
....
# Wrap result in root
if options[:root_name].present?
@_root_name = options[:root_name]
else # no root
@_root_name = nil
end
It will be cool if we could call "class.model_name" or just "class.to_s" on each object (i.e. something like this):
def compile_hash(options={})
....
# Wrap result in root
if options[:root_name].present?
@_root_name = options[:root_name]
else # no root
@_root_name = determine_object_root(@_object, options[:root])
end
The text was updated successfully, but these errors were encountered:
I'm not using XML output in production anywhere so if you can submit a patch with tests, I'll gladly review it.
There are tests for everything in the engine and builder in the root test suite but also both JSON and XML output tests in the rails3_2 fixture under fixtures/rails3_2/test/functional/. Though I added the XML ones, it was just for caching so if you need to expand those - I'd be happy to receive those as well.
Let's assume I have a collection with different object classes (STI). For example, I have a "Whoot" base class and "ReWhoot" as subclass and my API returns both Whoots and Rewhoots in a single collection.
Output for xml version looks like this:
But actually second object is instance of Whoot and it will be nice to output this node as
options[:root_name] is calculated only once and used for any object
It will be cool if we could call "class.model_name" or just "class.to_s" on each object (i.e. something like this):
The text was updated successfully, but these errors were encountered: