billie66 / image

upload and crop a image
0 stars 0 forks source link

carrierwave recreate_versions with random filename #8

Open billie66 opened 9 years ago

billie66 commented 9 years ago

若上传文件采用随机名,且更新文件时用到 recreate_versions 方法,会重新生成文件名, 但文件内容不更新,仍然是原来的文件。

billie66 commented 9 years ago

http://www.davidverhasselt.com/set-attributes-in-activerecord/

billie66 commented 9 years ago

https://github.com/carrierwaveuploader/carrierwave/wiki/How-to:-Create-random-and-unique-filenames-for-all-versioned-files

按照上面文档中定义 filename 可以避免这个问题