equivalent / equivalent/copy_carrierwave_file
Rename file name issues
- Dominant language
- Ruby
- Stars
- 36
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
@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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the reported Attachment and AttachmentUploader examples, especially duplicate_file and the uploader filename method. Reproduce the copy with CarrierWave and compare the stored file name with the database value; done means the copied file is stored under the new name without leaving the old-named copy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100