Let’s see this modularity first hand by building up a CarrierWave uploader from scratch.
To begin with, we’ll install CarrierWave:
gem install carrierwave
Then, we can make the world’s shortest uploader:
require 'carrierwave' class MyUploader < CarrierWave::Uploader::Base storage :file end
Even at this point, we can start saving files:
file = File.open('example.jpg') uploader = MyUploader.new uploader.store!(file)
If you’re ready for more, check out:
- the readme
- the wiki
- the Mocking fog when using it with CarrierWave post from Mike Gehard
- and the How to set up CarrierWave for local storage with AppCloud documentation for Engine Yard AppCloud users.
I’m sure you’ll enjoy using CarrierWave as much as I have!
Source: Union Station