Skip to content

Instantly share code, notes, and snippets.

@tonkec
Created April 16, 2016 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonkec/fd65151b5fc97ea91ba50e5c865c68bd to your computer and use it in GitHub Desktop.
Save tonkec/fd65151b5fc97ea91ba50e5c865c68bd to your computer and use it in GitHub Desktop.
class AvatarUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
if Rails.env.production?
storage :fog
else
storage :file
end
end
CarrierWave.configure do |config|
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
region: ENV['AWS_S3_REGION'],
path_style: true
}
config.fog_directory = ENV['S3_BUCKET_NAME']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment