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.

21 lines
642 B

9 years ago
#!/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
9 years ago
CarrierWave.clean_cached_files!
9 years ago
object.update_attribute(args[:mount_uploader].to_sym, object.instance_eval(args[:mount_uploader]))
rescue
false
end
end
end
end