Last active
August 29, 2015 14:02
-
-
Save scarfacedeb/c86c8240bc5747eb0535 to your computer and use it in GitHub Desktop.
A quick and dirty way to download files from s3 to local for development
This file contains 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
CarrierWave.configure do |config| | |
if Rails.env.development? || Rails.env.test? | |
config.storage = :file | |
else | |
config.storage = :fog | |
config.fog_credentials = { | |
provider: 'AWS', | |
aws_access_key_id: Rails.application.secrets.aws_access_key_id, | |
aws_secret_access_key: Rails.application.secrets.aws_secret_access_key | |
} | |
config.fog_directory = Rails.application.secrets.s3_bucket_name | |
end | |
end |
This file contains 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
s3 = "https://***.s3.amazonaws.com" | |
Post.find_each {|post| (post.remote_logo_url = "#{s3}#{post.logo.url}"; post.save!) if post.logo.blank? } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment