Skip to content

Instantly share code, notes, and snippets.

View lksv's full-sized avatar

Lukas Svoboda lksv

  • Brno, Czech Republic
View GitHub Profile
@lassebunk
lassebunk / dragonfly_tasks.rake
Last active September 14, 2022 07:18
Migrate all Dragonfly images to Amazon S3 using rake task
# This will move all images and other Dragonfly assets from your local server file system to Amazon S3.
namespace :dragonfly do
task :migrate_to_s3 => :environment do
# Adjust this line to meet your needs:
{ Product => [:image_uid, :other_uid], Page => :image_uid }.each do |klass, col|
puts "Migrating #{klass.table_name}..."
Array(col).each do |col|
klass.where("#{col} != ''").find_each do |instance|
begin