equivalent / copy_carrierwave_file

Copy Carrierwave files between records
MIT License
35 stars 17 forks source link

Rename file name issues #10

Open itayariely opened 7 years ago

itayariely commented 7 years ago

@equivalent Hi, I trying to rename the duplicated file:

class Attachment < ActiveRecord::Base mount_uploader :attachment, AttachmentUploader belongs_to :attachmentable, polymorphic: true include CopyCarrierwaveFile def duplicate_file(original) copy_carrierwave_file(original, self, :attachment) self.save! end end

class AttachmentUploader < CarrierWave::Uploader::Base def filename "#{model.attachmentable.name}-REV##{model.attachmentable.ver}-SN##{model.attachmentable.doc.sn}.#{file.extension}".to_s.underscore end end

But the result is that the file is saved in the old name and in the new DB name.

equivalent commented 7 years ago

@itayariely sorry you need to provide more details / description / irb output. As of lack of details I don't understand your isses