ref: master
lib/tasks/cache.rake
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
namespace :cache do task :private_files => :environment do require 'sdbm' hash = {} UploadedFile.where(:published => false).find_each do |uploaded_file| hash[uploaded_file.public_filename] = uploaded_file.full_path end dbm = SDBM.open(UploadedFile::DBM_PRIVATE_FILE) dbm.update(hash) dbm.close end end |