app/uploaders/document_uploader.rb
class DocumentUploader < CarrierWave::Uploader::Base
include LocalCache
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_whitelist
Document.file_extension_whitelist
end
end