Sha256: 189e7a75972959347b3bbe10792b6c6693a77032a68ce7c8cfe261f79297a990

Contents?: true

Size: 498 Bytes

Versions: 19

Compression:

Stored size: 498 Bytes

Contents

namespace :attached do
  
  desc "Process a given 'model' and 'attachment'"
  task :process, [:model, :attachment] => :environment do |t, args|
    
    model = args[:model] or raise "must specify model"
    attachment = args[:attachment] or raise "must specify attachment"
    
    klass = model.camelize.constantize or raise "invalid model '#{model}'"
    
    klass.all.each do |instance|
      instance.send(attachment).reprocess!
      instance.send(attachment).save
    end
    
  end
  
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
attached-0.5.5 lib/tasks/attached.rake
attached-0.5.4 lib/tasks/attached.rake
attached-0.5.3 lib/tasks/attached.rake
attached-0.5.2 lib/tasks/attached.rake
attached-0.5.1 lib/tasks/attached.rake
attached-0.5.0 lib/tasks/attached.rake
attached-0.4.9 lib/tasks/attached.rake
attached-0.4.8 lib/tasks/attached.rake
attached-0.4.7 lib/tasks/attached.rake
attached-0.4.6 lib/tasks/attached.rake
attached-0.4.5 lib/tasks/attached.rake
attached-0.4.4 lib/tasks/attached.rake
attached-0.4.3 lib/tasks/attached.rake
attached-0.4.2 lib/tasks/attached.rake
attached-0.4.1 lib/tasks/attached.rake
attached-0.4.0 lib/tasks/attached.rake
attached-0.3.9 lib/tasks/attached.rake
attached-0.3.8 lib/tasks/attached.rake
attached-0.3.7 lib/tasks/attached.rake