Commit b8221c6b by Jon Yurek

S3 Regions in the cucubmer specs

parent 0e8c21b6
...@@ -77,5 +77,5 @@ Feature: Rails integration ...@@ -77,5 +77,5 @@ Feature: Rails integration
And I attach the file "spec/support/fixtures/5k.png" to "Attachment" on S3 And I attach the file "spec/support/fixtures/5k.png" to "Attachment" on S3
And I press "Submit" And I press "Submit"
Then I should see "Name: something" Then I should see "Name: something"
And I should see an image with a path of "http://s3.amazonaws.com/paperclip/attachments/original/5k.png" And I should see an image with a path of "http://s3-us-west-2.amazonaws.com/paperclip/attachments/original/5k.png"
And the file at "http://s3.amazonaws.com/paperclip/attachments/original/5k.png" should be uploaded to S3 And the file at "http://s3-us-west-2.amazonaws.com/paperclip/attachments/original/5k.png" should be uploaded to S3
...@@ -209,11 +209,12 @@ module Paperclip ...@@ -209,11 +209,12 @@ module Paperclip
host_name = @options[:s3_host_name] host_name = @options[:s3_host_name]
host_name = host_name.call(self) if host_name.is_a?(Proc) host_name = host_name.call(self) if host_name.is_a?(Proc)
host_name || s3_credentials[:s3_host_name] || "s3.amazonaws.com" region = ["s3", s3_region].compact.join("-")
host_name || s3_credentials[:s3_host_name] || "#{region}.amazonaws.com"
end end
def s3_region def s3_region
region = @options[:s3_region] region = @options[:s3_region] || s3_credentials[:s3_region]
region = region.call(self) if region.is_a?(Proc) region = region.call(self) if region.is_a?(Proc)
region || s3_credentials[:s3_region] region || s3_credentials[:s3_region]
......
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