I'm trying to save pdf files with Shrine. Following Shrine readme, I'm attributing
my_model.image = File.open('my_pdf.pdf')
but that raises an error:
Encoding::UndefinedConversionError: "\xFE" from ASCII-8BIT to UTF-8
How can I acomplish this? There is a way to save binary files with Shrine?
Here is the uploader I'm using:
class DocumentUploader < Shrine
  plugin :logging
  plugin :validation_helpers
  plugin :determine_mime_type, analyzer: :mimemagic
  plugin :data_uri
  Attacher.validate do
    validate_max_size 20*1024*1024, message: "is too large (max is 20 MB)"
    validate_mime_type_inclusion %w[
      image/jpeg
      image/gif
      image/bmp
      image/png
      image/tiff
      application/pdf
    ]
  end
end