class AttachmentUploader < CarrierWave::Uploader::Basedef filename"#{model.attachmentable.name}-REV##{model.attachmentable.ver}-SN##{model.attachmentable.doc.sn}.#{file.extension}".to_s.underscoreendend
But the result is that the file is saved in the old name and in the new DB name.
@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.