about summary refs log tree commit diff
path: root/lib/paperclip/transcoder_extensions.rb
blob: c0b2447f3ea54207273a44d66be9d4b5bb55a740 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

module Paperclip
  module TranscoderExtensions
    # Prevent the transcoder from modifying our meta hash
    def initialize(file, options = {}, attachment = nil)
      meta_value = attachment&.instance_read(:meta)
      super
      attachment&.instance_write(:meta, meta_value)
    end
  end
end

Paperclip::Transcoder.prepend(Paperclip::TranscoderExtensions)