Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix support for multiple distinct S3 buckets (previously all classes …

…would use the bucket configured for the last class defined).
  • Loading branch information...
commit f0cb97936ad618ea68e2d5c5cbd3e2f7ee4bb4ee 1 parent 81402bf
Russ Ennis authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/technoweenie/attachment_fu/backends/s3_backend.rb
View
5 lib/technoweenie/attachment_fu/backends/s3_backend.rb
@@ -174,10 +174,11 @@ def self.included(base) #:nodoc:
bucket_key = base.attachment_options[:bucket_key]
if bucket_key and s3_config[bucket_key.to_sym]
- @@bucket_name = s3_config[bucket_key.to_sym]
+ eval_string = "def bucket_name()\n \"#{s3_config[bucket_key.to_sym]}\"\nend"
else
- @@bucket_name = s3_config[:bucket_name]
+ eval_string = "def bucket_name()\n \"#{s3_config[:bucket_name]}\"\nend"
end
+ base.class_eval(eval_string, __FILE__, __LINE__)
Base.establish_connection!(s3_config.slice(:access_key_id, :secret_access_key, :server, :port, :use_ssl, :persistent, :proxy))
Please sign in to comment.
Something went wrong with that request. Please try again.