如何使用 CarrierWave 重命名现有图像? (这个问题很接近,但并不完全相同: Renaming uploaded files with Carrierwave )例如,如果 model.image.url
是 foo-bar-jpg
如何将文件和相应的数据库字段重命名为 foo-bar.jpg
?model.image.recreate_versions!
将创建新文件,但在数据库中它不会更改模型的图像字段。
最佳答案
locomotive branch Carrierwave 的似乎支持重命名 - 具体文件是 here .
有file rename support在主要转换文件类型时,但不支持重命名:
"This should help with situations where a file has multiple versions,
and at least one of the versions is of a different format than the master version."
关于ruby-on-rails - 重命名现有的 CarrierWave 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8650907/