transcoder_extensions.rb 391 B

1234567891011121314
  1. # frozen_string_literal: true
  2. module Paperclip
  3. module TranscoderExtensions
  4. # Prevent the transcoder from modifying our meta hash
  5. def initialize(file, options = {}, attachment = nil)
  6. meta_value = attachment&.instance_read(:meta)
  7. super
  8. attachment&.instance_write(:meta, meta_value)
  9. end
  10. end
  11. end
  12. Paperclip::Transcoder.prepend(Paperclip::TranscoderExtensions)