Skip to content

Instantly share code, notes, and snippets.

@slbug
Created June 7, 2011 19:59
Show Gist options
  • Save slbug/1013026 to your computer and use it in GitHub Desktop.
Save slbug/1013026 to your computer and use it in GitHub Desktop.
diff --git a/lib/carrierwave/uploader/processing.rb b/lib/carrierwave/uploader/processing.rb
index 7c37d5b..73994cd 100644
--- a/lib/carrierwave/uploader/processing.rb
+++ b/lib/carrierwave/uploader/processing.rb
@@ -8,7 +8,7 @@ module CarrierWave
include CarrierWave::Uploader::Callbacks
included do
- class_inheritable_accessor :processors, :instance_reader => false, :instance_writer => false
+ class_attribute :processors, :instance_writer => false
self.processors = []
after :cache, :process!
@@ -63,10 +63,10 @@ module CarrierWave
if arg.is_a?(Hash)
condition = arg.delete(:if)
arg.each do |method, args|
- processors.push([method, args, condition])
+ self.processors += [[method, args, condition]]
end
else
- processors.push([arg, [], nil])
+ self.processors += [[arg, [], nil]]
end
end
end
diff --git a/lib/carrierwave/uploader/versions.rb b/lib/carrierwave/uploader/versions.rb
index 8e26461..c124901 100644
--- a/lib/carrierwave/uploader/versions.rb
+++ b/lib/carrierwave/uploader/versions.rb
@@ -76,6 +76,7 @@ module CarrierWave
RUBY
# as the processors get the output from the previous processors as their
# input we must not stack the processors here
+ versions[name][:uploader].processors = versions[name][:uploader].processors.dup
versions[name][:uploader].processors.clear
end
versions[name][:uploader].class_eval(&block) if block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment