Dear All,
How to export a table data to xml file using Ruby on Rails. I followed
this code it's created xml file like table.Anyone knows please suggest
me.

Controller
headers['Content-Type'] = "text/xml"
headers['Content-Disposition'] = 'attachment; filename="xml-export.xml"'
headers['Cache-Control'] = ''
@records = Company.find(:all)

View
<table border="1">
  <th>Name</th>
  <th>Address1</th>
  <th>Address2</th>
<% @records.each do |c|  %>

  <tr><td><%= c.name %></td>
  <td><%= c.com_address1 %></td>
  <td><%= c.com_address2 %></td>
  </tr>
<% end %></table>


XML File is
- <table border="1">
  <th>Name</th>
  <th>Address1</th>
  <th>Address2</th>
- <tr>
  <td>xx</td>
  <td>xx</td>
  <td>xx</td>
  </tr>
- </table>
Regards
R.Devi
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to