Skip to content

Instantly share code, notes, and snippets.

@leemour
Last active December 19, 2015 00:09
Show Gist options
  • Save leemour/5866407 to your computer and use it in GitHub Desktop.
Save leemour/5866407 to your computer and use it in GitHub Desktop.
Pass a file to Rails Console. Recreate versons of images with Carrierwave
# bundle exec rails runner "eval(File.read 'lib/scripts/recreate_versions.rb')"
Product.all.each do |p|
%w(photo1 photo2 photo3 photo4 photo5).map(&:to_sym).each do |photo|
p.send(photo).recreate_versions! if p.read_attribute(photo).present?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment