Skip to content

Instantly share code, notes, and snippets.

@sporkd
Created October 1, 2011 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sporkd/1256806 to your computer and use it in GitHub Desktop.
Save sporkd/1256806 to your computer and use it in GitHub Desktop.
Save carrierwave attachment to tempfile
Tempfile.open("attachment", "#{Rails.root}/tmp") do |f|
f.binmode # my attachment is binary
f.write(model.attachment.file.read)
end
@princejoseph
Copy link

dont you need to unlink the file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment