Sha256: 07beb39e51a92feda9a062b99b85f594d9b99bde01250b59dc354125e8ca4162

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 Bytes

Contents

namespace :attached do
  
  desc "Process a given 'model' and 'attachment'."
  task :process, :model, :attachment, :needs => :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!
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
attached-0.1.8 lib/tasks/attached.rake
attached-0.1.7 lib/tasks/attached.rake
attached-0.1.6 lib/tasks/attached.rake