Skip to content

Instantly share code, notes, and snippets.

@GWillmann
Last active November 30, 2017 12:45
Show Gist options
  • Save GWillmann/d7900a94181818d846277411b1f01661 to your computer and use it in GitHub Desktop.
Save GWillmann/d7900a94181818d846277411b1f01661 to your computer and use it in GitHub Desktop.
Paperclip file to encoded Base64 Byte array
require 'base64'
byte_array_file = Paperclip.io_adapters.for(attachment.file).read
Base64.encode64(byte_array_file)
Thanks to Jonathar (https://gist.github.com/jonathar/731c5c4c3273d26f5369#file-paperclip-byte-buffer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment