Permalink
Browse files

Unlink the file **and** close the file descriptor when clearing the a…

…ttachments
  • Loading branch information...
1 parent 4be2fdc commit b346dd654aebd7f1be46503bf500e89e75d45fc4 @exviva committed May 15, 2012
Showing with 7 additions and 2 deletions.
  1. +5 −0 CHANGELOG.md
  2. +2 −2 lib/paperclip/storage/tmp.rb
View
5 CHANGELOG.md
@@ -1,3 +1,8 @@
+## Not released yet:
+
+* Unlink the file **and** close the file descriptor when clearing
+ the attachments
+
## 0.0.3 (2012-05-15):
* Depend on Paperclip `>= 2.4.2`, which properly handles
View
4 lib/paperclip/storage/tmp.rb
@@ -7,7 +7,7 @@ def self.fs
# Deletes the temporary files and releases references to them
def self.clear
- fs.each_value {|f| f.unlink }
+ fs.each_value {|f| f.close! }
@fs = nil
end
@@ -31,7 +31,7 @@ def flush_writes
def flush_deletes
@queued_for_delete.each do |path|
if file = Tmp.fs.delete(path)
- file.unlink
+ file.close!
end
end

0 comments on commit b346dd6

Please sign in to comment.