I''m having some trouble with active record with sqlite2. I''m
getting a
undefined method `rollback'' for #<SQLite::Database error.
I''m not sure
what I have done wrong.
Robert Boone
#!/usr/bin/ruby
$:.unshift(File.dirname(__FILE__) + ''/lib'')
require ''data''
require ''fileutils''
class Tif < ActiveRecord::Base
end
image_dir = "images/"
base = {
:LOCAL => "/mnt/d/",
:OPTICAL => "/mnt/o/",
}
tifs = Tif.find(:all,
:order => "path",
:limit => 10)
tifs.each do |tif|
tif_name = tif.path.split("/")[-1] + ''.tif''
path = if tif.path =~ /LOCAL/
sprintf "%sLOCALSTORAGE/%s", base[:LOCAL], tif.path
else
sprintf "%s%s",base[:OPTICAL], tif.path
end
if File.exists? path
oldsize = File.size path
newpath = "#{image_dir}#{tif_name}"
FileUtils.cp(path, newpath)
newsize = File.size newpath
if oldsize == newsize
tif.processed = 1;
tif.save
end
end
end