Sha256: a5aaba0eb119b287924bc13013ff679496ffe680666b871eedc1c82614d71295

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

CarrierWave::SanitizedFile.sanitize_regexp = /[^[:print:]]/

CarrierWave.configure do |config|
  config.root = 
    if ::Rails.env.test?
      "/tmp/#{::Rails.application.class.parent_name.underscore}/#{::Rails.env}"
    else
      "/data/#{::Rails.application.class.parent_name.underscore}/#{::Rails.env}"
    end

  unless ::Rails.env.test?
    if File.exists?('config/aws.yml')
      require 'carrierwave/storage/fog'
      config.storage :fog
      config.cache_storage :fog
  
      config.fog_provider = 'fog/aws'
      aws = YAML.load_file('config/aws.yml')
  
      config.fog_credentials = {
        provider: 'AWS',
        aws_access_key_id: aws['s3']['access_key_id'],
        aws_secret_access_key: aws['s3']['secret_access_key'],
        region: aws['s3']['region']
      }
      config.fog_directory = aws['s3']['bucket']
    end
  end
end

module Daddy
  module Uploader
    class Base < CarrierWave::Uploader::Base

      def store_dir
        "#{model.class.to_s.underscore.pluralize}/#{model.id.to_s}/#{mounted_as}"
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
daddy-0.6.2 lib/daddy/uploader.rb
daddy-0.6.1 lib/daddy/uploader.rb
daddy-0.6.0 lib/daddy/uploader.rb
daddy-0.5.34 lib/daddy/uploader.rb
daddy-0.5.33 lib/daddy/uploader.rb
daddy-0.5.32 lib/daddy/uploader.rb