Hi,
I am writing text from a TEXT field in my database to a newly created
file. However i can''t seem to be able to maintain newlines, tabs etc. I
am currently using the following code (even using ''puts''
doesn''t work):
File.open( "#{@file.name}.rb", ''w'' ) {|file|
file.puts(@file.text)
Any help on this would be very much appreciated.
Thanks for your time.
--~--~---------~--~----~------------~-------~--~----~
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,
I am writing text from a TEXT field in my database to a newly created
file. However i can''t seem to be able to maintain newlines, tabs etc. I
am currently using the following code (even using ''puts''
doesn''t work):
File.open( "#{@file.name}.rb", ''w'' ) {|file|
file.puts(@file.text)
Any help on this would be very much appreciated.
Thanks for your time.
--
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
-~----------~----~----~----~------~----~------~--~---
James Smith wrote:> Hi, > > I am writing text from a TEXT field in my database to a newly created > file. However i can''t seem to be able to maintain newlines, tabs etc. I > am currently using the following code (even using ''puts'' doesn''t work): > > File.open( "#{@file.name}.rb", ''w'' ) {|file| file.puts(@file.text) > > Any help on this would be very much appreciated. > Thanks for your time.File.open( "#{@file.name}.rb", ''w'' ) { |f| f.write @file.text } should do it. -- 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 -~----------~----~----~----~------~----~------~--~---