Hello, im generating xml data without problems when working as a web service(accesing from the action), but i cant figure it out how to instead of showing that xml data in the browser it gets writed on a xml in the public folder, i really havent find a way to do this and im getting a little nervous, thi is what i have: http://www.rorpaste.com/paste/details/812 Any help in how to get that data on the public folder will be very appreciated. :) -- 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 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 -~----------~----~----~----~------~----~------~--~---
Evan Thomas wrote:> Hello, > > im generating xml data without problems when working as a web > service(accesing from the action), but i cant figure it out how to > instead of showing that xml data in the browser it gets writed on a xml > in the public folder, i really havent find a way to do this and im > getting a little nervous, thi is what i have: > > http://www.rorpaste.com/paste/details/812 > > Any help in how to get that data on the public folder will be very > appreciated. :)you need to save this to a file - so instead of using a template, create the xml as output (REXML; ruby xml), and save it into a file with the File class. http://www.germane-software.com/software/rexml/docs/tutorial.html is an excellent link. (documentation http://www.germane-software.com/software/rexml/doc/index.html ) after you create the xml, use the File class to create the file File.open(RAILS_ROOT+''public/somefile.xml'', ''w'') do |file| file << The_Xml_Output end hth -- 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 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 -~----------~----~----~----~------~----~------~--~---
Hi,> you need to save this to a file - so instead of using a template, create > the xml as output (REXML; ruby xml), and save it into a file with the > File class. >you still have another option here if you want to use a builder (rxml) template. In your controller you can use render_to_string for calling the action associated to the rxml and get the output as a string. Then you can do exactly as Shai told you for saving it to a file :) regards, javier ramirez --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---