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
Name | Address1 | Address2 | <% @records.each do |c| %>
---|---|---|
<%= c.name %> | <%= c.com_address1 %> | <%= c.com_address2 %> |
XML File is
-
Name Address1 Address2 xx xx xx
Regards
R.Devi