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! --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''ve used the tutorial at the top with great success the last couple of weeks. http://wiki.rubyonrails.org/rails/pages/HowToExportToExcel On Sep 15, 7:59 am, Nik <NiKS...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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!--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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:> 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! > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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! On Sep 16, 3:45 am, Rob Lacey <r...-JfOZzmRpUsu/uRbK1X5IkLHvCTsVnGdA@public.gmane.org> wrote:> 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: > > 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!--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---