XML/Excel export?

Good morning, all!

Can anyone point me to the direction of creating a link that leads to
the downloading of a rails generated XML file. I have an app and a
database both called catalog, and I have
a controller called store, and a model called product. The database
has a products table with a handful of manually input product items.

The controller is quite plain with an index and a @products =
Product.find(:all)

How may I create a button or link that leads to the generating of an
XML file and one to Excel (is it possible? I mean, copyright and
loyalty to MS a concern?). And how can I make it so that after
clicking this link or button or both, the browser prompts for a
download instead of displaying it on itself like Firefox and Internet
Explorer do. Google Chrome just displays it in one line, I haven't
checked Safari yet.

Thank you in advance!

I've used the tutorial at the top with great success the last couple
of weeks.

http://wiki.rubyonrails.org/rails/pages/HowToExportToExcel

Hey there,

Presumably you have a ProductsController, if you have a route for your
Products resource Rails should cope with a request for

http://localhost:3000/products.xml

./config/routes.rb
map.resources :products

you then write a view and format the XML as you'd like it to appear in
the following view file
./app/views/products/index.rxml.erb

RobL

Nik wrote:

Thank You for both of your suggestions. Let me try it out.

RobL, how does one format an XML file? I am sorry to trouble you if
this seems very elementary which I wouldn't suspect otherwise. Because
I thought XML is always just a bunch of structured data and Firefox is
the one that formats it and displays it.

Or do you mean, I giving the data the structure I want in that
rxml.erb file?

Thank You!