Skip to content

Commit

Permalink
Fix support for multiple distinct S3 buckets (previously all classes …
Browse files Browse the repository at this point in the history
…would use the bucket configured for the last class defined).
  • Loading branch information
Russ Ennis committed Feb 15, 2009
1 parent 81402bf commit f0cb979
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/technoweenie/attachment_fu/backends/s3_backend.rb
Expand Up @@ -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))

Expand Down

0 comments on commit f0cb979

Please sign in to comment.