A storage plugin for carrierwave that will retrieving files from a secondary storage if the file is not present in the primary storage. New files will always be stored in the primary storage. This is perfect for use while migrating from one storage to another, or to avoid polluting a production environment when running a staging mirror.
Add this line to your application's Gemfile:
gem 'carrierwave-cascade'
Configure carrierwave to use Cascade as its storage engine. Then set primary and secondary storages to be used. Supply other configuration as needed for the storages.
CarrierWave.configure do |config|
config.storage = :cascade
config.primary_storage = :file
config.secondary_storage = :fog
config.fog_credentials = {
:provider => 'AWS'
}
end
By default, cascade will prevent files from being deleted out of the secondary storage. If you wish secondary storage file to be deleted, specify this in the configs.
CarrierWave.configure do |config|
config.allow_secondary_file_deletion = true
end
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request