Created
August 24, 2016 15:24
-
-
Save czj/511ed37657506f99be1a24534b838ab1 to your computer and use it in GitHub Desktop.
Re-generate Shrine.rb attached file versions for a Rails model
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
# Run in smalls batches, for memory usage and to re-start on failure / SSH connexion lost | |
600.times { |i| | |
n = i * 100 | |
puts "Processing #{n} ..." | |
Imaj.where(id: (n + 1)..(n + 100)).each { |e| | |
e.update!(picture: e.picture[:original]) if e.picture_attacher.stored? | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment