Skip to content

Instantly share code, notes, and snippets.

@rwc9u
Created July 19, 2010 17:18
Show Gist options
  • Save rwc9u/481683 to your computer and use it in GitHub Desktop.
Save rwc9u/481683 to your computer and use it in GitHub Desktop.
klass = Paperclip::Storage::Filesystem
klass.module_eval do
def flush_writes #:nodoc:
logger.info("[paperclip-hack] Writing files for #{name}")
@queued_for_write.each do |style, file|
file.close
FileUtils.mkdir_p(File.dirname(path(style)))
logger.info("[paperclip-hack] -> #{path(style)}")
FileUtils.cp(file.path, path(style))
FileUtils.rm(file.path)
FileUtils.chmod(0644, path(style))
end
@queued_for_write = {}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment