Sha256: d912666c71ae7bee16d9f890129eab192844d6ee012496a2ddf598c0072ae0a0

Contents?: true

Size: 478 Bytes

Versions: 13

Compression:

Stored size: 478 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

13 entries across 13 versions & 1 rubygems

Version Path
attached-1.0.7 lib/tasks/attached.rake
attached-1.0.6 lib/tasks/attached.rake
attached-1.0.5 lib/tasks/attached.rake
attached-1.0.4 lib/tasks/attached.rake
attached-1.0.3 lib/tasks/attached.rake
attached-1.0.2 lib/tasks/attached.rake
attached-1.0.1 lib/tasks/attached.rake
attached-1.0.0 lib/tasks/attached.rake
attached-0.6.0 lib/tasks/attached.rake
attached-0.5.9 lib/tasks/attached.rake
attached-0.5.8 lib/tasks/attached.rake
attached-0.5.7 lib/tasks/attached.rake
attached-0.5.6 lib/tasks/attached.rake