Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUGFIX: attachment_fu should now work correctly on windows

  • Loading branch information...
commit 2b74cfb30d3e69bffdda4bf7cbc936fe0342c3c5 1 parent 5c39087
Luke Brown authored parndt committed
Showing with 19 additions and 0 deletions.
  1. +3 −0  config/application.rb
  2. +16 −0 lib/attachment_fu_patch.rb
View
3  config/application.rb
@@ -85,5 +85,8 @@ def gem_version
config.gem "slim_scrooge", :version => ">= 1.0.3", :lib => "slim_scrooge", :source => "http://gemcutter.org" unless RUBY_PLATFORM =~ /mswin|mingw/ # kill gem when windows is running.
config.gem "hpricot", :version => ">= 0.8.1", :lib => "hpricot", :source => "http://gemcutter.org"
#===REFINERY END OF REQUIRED GEMS===
+
+ # Pull in attachment_fu patch for windows
+ require 'attachment_fu_patch' if RUBY_PLATFORM =~ /mswin/
end
end
View
16 lib/attachment_fu_patch.rb
@@ -0,0 +1,16 @@
+# This patches the windows tempfile problem that attachment_fu depends on. See:
+# http://epirsch.blogspot.com/2008/01/fixing-attachmentfu-on-windows-like.html
+
+require 'tempfile'
+
+class Tempfile
+ def size
+ if @tmpfile
+ @tmpfile.fsync # added this line
+ @tmpfile.flush
+ @tmpfile.stat.size
+ else
+ 0
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.