Inconsistency in calling to_xml on STI returning <record>


#1

Hi,

When calling to_xml on STI that returns heterogeneous type of records,
each record is contained in node.
For example, if I have Account with subclasses EmailAccount and
PhoneAccount, Account.find(:all).to_xml gives me:

<emailaddress1 …>


<phonenumber1…>

When calling to_xml on homogeneous type of records, each record is
contained in the node with the type.
For example, Account.find(:all, :conditions=>{:type => ‘PhoneAccount’})
<phone_account>
<phonenumber1…>
</phone_account>

I feel this makes writing test and client-side parsing difficult. I
did some search and didn’t find anything solutions (except a trac
ticket opened over a year ago with status open). I also feel this is
probably a often-encountered issue and have some
pragmatic solution. Any suggestion is appreciated.

Thanks,


Zhao