From: Nebs Petrovic [mailto:nebs_man / hotmail.com] 
# myfile = File.new("somefile.txt", "r+")

myfile = File.new("somefile.txt", "w")
                                ^^^^^^^

# myfile.puts "Hello"
# myfile.close

try using the block form File.open since it opens and close for you, eg

create the file,

> File.open("somefile.txt", "w") do |f|
    f.puts "Hello"
  end
#=> nil

then read it back

> File.open("somefile.txt", "r") do |f|
    puts f.gets
  end
Hello
#=> nil