Skip to content

Instantly share code, notes, and snippets.

@scarfacedeb
Last active August 29, 2015 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scarfacedeb/c86c8240bc5747eb0535 to your computer and use it in GitHub Desktop.
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
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
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