I've just upgraded a project to Ruby 1.9.2 and the following line crashes the app with 'undefined method `copy' for File:Class'
File.copy(animage.image.path(:export), destfile)
I have the following libraries loaded in this module
require 'zip/zipfilesystem'
require 'iconv'
require 'net/ftp'
require 'fileutils'
It should actually be FileUtils.copy
or FileUtils.cp
. I wonder how your old project worked with just File.copy, as File doesn't have that method.
refer here: http://santoro.tk/mirror/ruby-core/classes/FileUtils.html#M004325
You were probably using ftools in 1.8:
ftools adds several (class, not instance) methods to the File class, for copying, moving, deleting, installing, and comparing files, as well as creating a directory path. See the File class for details.
ftools was replaced by fileutils in 1.9, about the 6th element in this list of standard library changes in 1.9 from Dave Thomas
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With