Class: CarrierWave::Storage::CloudFiles
- Defined in:
- lib/carrierwave/storage/cloud_files.rb
Overview
Uploads things to Rackspace Cloud Files webservices using the Rackspace libraries (cloudfiles gem). In order for CarrierWave to connect to Cloud Files, you’ll need to specify an username, api key and container
CarrierWave.configure do |config|
config.cloud_files_username = "xxxxxx"
config.cloud_files_api_key = "xxxxxx"
config.cloud_files_container = "my_container"
end
You can set the access policy for the uploaded files:
CarrierWave.configure do |config|
config.s3_access_policy = 'public-read'
end
Defined Under Namespace
Classes: File
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
-
#retrieve!(identifier) ⇒ Object
Do something to retrieve the file.
-
#store!(file) ⇒ Object
Store the file on Cloud Files.
Methods inherited from Abstract
Constructor Details
This class inherits a constructor from CarrierWave::Storage::Abstract
Instance Method Details
#retrieve!(identifier) ⇒ Object
Do something to retrieve the file
- identifier (String)
-
uniquely identifies the file
Returns
- CarrierWave::Storage::RightS3::File
-
the stored file
162 163 164 |
# File 'lib/carrierwave/storage/cloud_files.rb', line 162 def retrieve!(identifier) CarrierWave::Storage::CloudFiles::File.new(uploader, self, uploader.store_path(identifier)) end |
#store!(file) ⇒ Object
Store the file on Cloud Files
Parameters
- file (CarrierWave::SanitizedFile)
-
the file to store
Returns
- CarrierWave::Storage::RightS3::File
-
the stored file
145 146 147 148 149 150 |
# File 'lib/carrierwave/storage/cloud_files.rb', line 145 def store!(file) = {'Content-Type' => file.content_type} f = CarrierWave::Storage::CloudFiles::File.new(uploader, self, uploader.store_path) f.store(file.read,) f end |