Forum: Ruby on Rails create rxml file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Brijesh S. (Guest)
on 2009-01-02 08:37
Hi All


#controller:
@users=User.find(:all,:conditions=>["id=12"])
@faxs=FaxService.find(:all,:conditions=>["user_id=12 "])

My view is generate like this:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<fax>
  <access_number_id type="integer">303</access_number_id>
</fax>
<fax>
  <access_number_id type="integer">302</access_number_id>
</fax>
<fax>
  <access_number_id type="integer">301</access_number_id>
</fax>

<fax>
  <access_number_id type="integer">305</access_number_id>
</fax>
<user>
  <country>US</country>
  <email>removed_email_address@domain.invalid</email>
  <id type="integer">12</id>
  <mobile_phone>4087723792</mobile_phone>

</user>
</users>


But i want like this
#View .rxml

<?xml version="1.0" encoding="UTF-8"?>
<users>

<user>
  <country>US</country>
  <email>removed_email_address@domain.invalid</email>
  <id type="integer">12</id>
  <mobile_phone>4087723792</mobile_phone>
   <fax>
     < access_number_id type="integer">303</access_number_id>
   </fax>
   <fax>
     <access_number_id type="integer">302</access_number_id>
   </fax>
   <fax>
      <access_number_id type="integer">301</access_number_id>
   </fax>

   <fax>
     <access_number_id type="integer">305</access_number_id>
   </fax>
</user>
</users>

can  some one tell me how to generate  xml file?
This topic is locked and can not be replied to.