Writing TEXT from my database to file

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.