Created
June 3, 2011 13:59
-
-
Save slbug/1006381 to your computer and use it in GitHub Desktop.
carrierwave fixes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/carrierwave/uploader/processing.rb b/lib/carrierwave/uploader/processing.rb | |
index 7c37d5b..678c0e5 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 | |
@@ -78,7 +78,7 @@ module CarrierWave | |
# | |
def process!(new_file=nil) | |
if enable_processing | |
- self.class.processors.each do |method, args, condition| | |
+ processors.each do |method, args, condition| | |
next if condition && !self.send(condition, new_file) | |
self.send(method, *args) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment