oh shoot, properly unlink outfit tempfiles now...

This commit is contained in:
Emi Matchu 2012-08-01 21:30:22 -04:00
parent a6e4398e54
commit 2435c7f7e9

View file

@ -91,12 +91,15 @@ class Outfit < ActiveRecord::Base
# and runs #save! on the record, so any other changes will also be saved. # and runs #save! on the record, so any other changes will also be saved.
def write_image! def write_image!
if image_layers_dirty? if image_layers_dirty?
Tempfile.open(['outfit_image', '.png']) do |image| image = Tempfile.open(['outfit_image', '.png'])
begin
create_image! image create_image! image
self.image_layers_hash = generate_image_layers_hash self.image_layers_hash = generate_image_layers_hash
self.image = image self.image = image
self.image_enqueued = false self.image_enqueued = false
save! save!
ensure
image.close!
end end
end end