From 2435c7f7e92ca7dc74099bac97c35375389de6a6 Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 1 Aug 2012 21:30:22 -0400 Subject: [PATCH] oh shoot, properly unlink outfit tempfiles now... --- app/models/outfit.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/outfit.rb b/app/models/outfit.rb index b0d9540a..acde70cb 100644 --- a/app/models/outfit.rb +++ b/app/models/outfit.rb @@ -91,12 +91,15 @@ class Outfit < ActiveRecord::Base # and runs #save! on the record, so any other changes will also be saved. def write_image! if image_layers_dirty? - Tempfile.open(['outfit_image', '.png']) do |image| + image = Tempfile.open(['outfit_image', '.png']) + begin create_image! image self.image_layers_hash = generate_image_layers_hash self.image = image self.image_enqueued = false save! + ensure + image.close! end end