Bike!Bike! Website!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
601 B

#!/usr/bin/env ruby
# CarrierWave rake tasks
#
# Task: reprocess
# Desc: Reprocess all images for a given class
# Usage: rake carrierwave:reprocess class=<ClassName> mount_uploader=<mount_uploader>
namespace :carrierwave do
task :reprocess, [:class, :mount_uploader] => :environment do |task, args|
desc "Reprocess all images for a given class."
args[:class].constantize.all.each do |object|
begin
object.update_attribute(args[:mount_uploader].to_sym, object.instance_eval(args[:mount_uploader]))
rescue
false
end
end
end
end