Created
February 13, 2019 15:50
-
-
Save Vchekryzhov/7af3a0e65b0d67573cdac96ad0f25850 to your computer and use it in GitHub Desktop.
carrierwave recreate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YourModel.find_each do |ym| | |
begin | |
ym.process_your_uploader_upload = true # only if you use carrierwave_backgrounder | |
ym.your_uploader.cache_stored_file! | |
ym.your_uploader.retrieve_from_cache!(ym.your_uploader.cache_name) | |
ym.your_uploader.recreate_versions!(:version1, :version2) | |
ym.save! | |
rescue => e | |
puts "ERROR: YourModel: #{ym.id} -> #{e.to_s}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment