I''ve written a rxml template. What must I write in my rails-controller to get xml files out of this - not displayed on the screen, but just saved on the hard disk? And where do I have to store the rxml file? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Well, if you already have a controller and the rxml template, then all you need do to get the xml written to the file system is to turn on page caching for that action. Check out the docs: http://api.rubyonrails.org/classes/ActionController/Caching/Pages.html#M000110 There''s also good coverage of caching in the agile rails book. Plus google will probably give you a lot of help too. b Luma wrote:> I''ve written a rxml template. What must I write in my rails-controller > to get xml files out of this - not displayed on the screen, but just > saved on the hard disk? And where do I have to store the rxml file? > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sébastien Boisvert (sebhtml)
2007-Mar-28 17:30 UTC
Re: creating xml files on the hard disk
Hi, On Mar 27, 7:42 pm, "Luma" <herbert....-zqRNUXuvxA0b1SvskN2V4Q@public.gmane.org> wrote:> I''ve written a rxml template. What must I write in my rails-controller > to get xml files out of this - not displayed on the screen, but just > saved on the hard disk? And where do I have to store the rxml file?Actually, you could be doing it without using caching....... class LaboratoryNotebookController < ApplicationController def index render :action => ''index.rxml'' fp = File.open RAILS_ROOT+"/myfile.xml", ''w+'' fp.write @response.body fp.close end end remember that XHTML is actually XML too, therefore, the rxml extension or the rhtml extension is not really important..... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
This is a good idea. Now I tried to simulate a post request for the action "create_xml" like this: xhr :post, :create_xml, :order => @order But rails doesn''t know the "xhr". Do I need to include "ActionController::TestProcess", and what is the syntax? undefined method `xhr'' for #<BestellContrController:0x4660374> RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/controllers/bestell_contr_controller.rb:19:in `save_order'' Thanks for help. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
It works. Thanks to both of you! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---