Hi I am having a problem with writing xml file. I am using REXML. Everything goes fine on IRB, i can add new elements to my existing file, add atributes or text. When i print my xml in IRB it looks ok. Then i try xml.write(STDOUT, 0), and i get no errors but the xml does not change. My persmissions look ok. I am working on windows XP. Any clue? -- 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 -~----------~----~----~----~------~----~------~--~---
Pabloz wrote:> I am having a problem with writing xml file. I am using REXML. > Everything goes fine on IRB,Stop using IRB and start using unit tests. You should write a little bit of a test case and ''p'' a result, then run ''rake recent'' and read your console. If the result is correct, write an assertion that locks it in and repeat. Small experiments with test cases will replace small experiments with IRB, and will preserve a history of correct results. This is how RoR itself was created, and it''s a major reason RoR is so powerful.> i can add new elements to my existing file, > add atributes or text. When i print my xml in IRB it looks ok. Then i > try xml.write(STDOUT, 0), and i get no errors but the xml does not > change. My persmissions look ok. I am working on windows XP. Any clue?STDOUT is your console''s handle as a file stream. It''s not a real file. Try this: File.open(''foo.xml'', ''w'') {|f| xml.write(f, 0) } -- Phlip http://www.greencheese.us/ZeekLand <-- NOT a blog!!! --~--~---------~--~----~------------~-------~--~----~ 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 -- On Wed, 29 Nov 2006, Phlip wrote:> > Pabloz wrote: > >> I am having a problem with writing xml file. I am using REXML. >> Everything goes fine on IRB, > > Stop using IRB and start using unit tests.Well... the world is a big place, and there''s room for lots of things :-) I agree with James Duncan Davidson that the Rails application console is a great debugging tool, and I''d say the same about irb in general. So are unit tests, of course :-) David -- David A. Black | dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB''s Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Phlip wrote:> Stop using IRB and start using unit tests. You should write a little bit > of > a test case and ''p'' a result, then run ''rake recent'' and read your > console. > If the result is correct, write an assertion that locks it in and > repeat. > Small experiments with test cases will replace small experiments with > IRB, > and will preserve a history of correct results. This is how RoR itself > was > created, and it''s a major reason RoR is so powerful. >thanks for the information! i really need to start using tests then, but first i will read a little about them. -- 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 -~----------~----~----~----~------~----~------~--~---
On 29 Nov 2006, at 15:54, Pabloz wrote:> thanks for the information! i really need to start using tests > then, but > first i will read a little about them.You may like to watch the latest Peepcode screencast on test-first development called, well, Test-First Development: http://peepcode.com/articles/2006/11/26/test-first-development Regards, Andy Stewart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---