public
Last active

  • Download Gist
carrierwave_fog.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => 'my_access_key', # required
:aws_secret_access_key => 'my_secret_access_key', # required
:region => 'us-east-1' # optional, defaults to 'us-east-1'
}
config.fog_directory = 'my_bucket_name' # required
config.fog_host = 'https://my_bucket_name.s3.amazonaws.com' # optional, defaults to nil
config.fog_public = false # optional, defaults to true
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {}
config.max_file_size = 30.megabytes # defaults to 5.megabytes
config.upload_expiration = 30.minutes # defaults to 10.hours
end
gemfile
1 2 3 4 5 6 7 8 9 10 11 12 13
source 'http://rubygems.org'
 
gem 'rails', '3.0.9'
 
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
 
gem 'mysql2', '~> 0.2.6'
gem 'rake', '0.8.7'
gem "aws-s3", :require => 'aws/s3'
gem 'carrierwave'
gem 'carrierwave_direct'
gem 'nokogiri'
image_uploader.rb
Ruby
1 2 3 4 5 6 7
class ImageUploader < CarrierWave::Uploader::Base
 
#storage :fog
include CarrierWaveDirect::Uploader
 
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.