Module: Shrine::Plugins::Copy::AttachmentMethods
- Defined in:
- lib/shrine/plugins/copy.rb
Instance Method Summary collapse
Instance Method Details
#initialize ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/shrine/plugins/copy.rb', line 12 def initialize(*) super name = define_method :initialize_copy do |record| super(record) instance_variable_set(:"@#{name}_attacher", nil) # reload the attacher attacher = send(:"#{name}_attacher") attacher.send(:write, nil) # remove original attachment attacher.copy(record.public_send(:"#{name}_attacher")) end # Fix for JRuby private :initialize_copy end |