Commit 5d8a132a by Jon Yurek

Don't create an S3 instance if we have one already

parent c9ee8b9e
......@@ -222,10 +222,15 @@ module Paperclip
config[opt] = s3_credentials[opt] if s3_credentials[opt]
end
AWS::S3.new(config.merge(@s3_options))
obtain_s3_instance_for(config.merge(@s3_options))
end
end
def obtain_s3_instance_for(options)
instances = (Thread.current[:paperclip_s3_instances] ||= {})
instances[options] ||= AWS::S3.new(options)
end
def s3_bucket
@s3_bucket ||= s3_interface.buckets[bucket_name]
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment