i have a doubt with acts_as_api. i want to format a xml string like this:
<root>
<child property="property_value">Some Text</child>
etc
</root>
this is possible?
thank's in advance
See Question&Answers more detail:osi have a doubt with acts_as_api. i want to format a xml string like this:
<root>
<child property="property_value">Some Text</child>
etc
</root>
this is possible?
thank's in advance
See Question&Answers more detail:osI think this will not work automagically as you want to put data in your XML structure in two different places:
But the attributes of your model are contained a single Hash.
acts_as_api
(or another serializer) can't determine which attributes are supposed to be in a property and which one should be taken as the inner text.
For this case you will have to provide your own serializer (you can have a look at http://api.rubyonrails.org/classes/ActiveRecord/Serialization.html#method-i-to_xml on how to do it in Rails.