Sha256: c16afe3fe4ae3146fa891af01838fecefb16aba2b7f5724ccae3b2188aa653f2
Contents?: true
Size: 1.1 KB
Versions: 26
Compression:
Stored size: 1.1 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'] config.fog_public = aws['s3'].fetch('public', false) 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
26 entries across 26 versions & 1 rubygems