Skip to content

Instantly share code, notes, and snippets.

@sporkd
Created October 1, 2011 23:31
Show Gist options
  • 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