Class: Kuhsaft::AssetBrickAssetUploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Defined in:
app/uploaders/kuhsaft/asset_brick_asset_uploader.rb

Instance Method Summary collapse

Instance Method Details

#extension_white_listObject

Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:



34
35
36
# File 'app/uploaders/kuhsaft/asset_brick_asset_uploader.rb', line 34

def extension_white_list
  %w(pdf doc docx xls xlsx ppt pptx)
end

#store_dirObject

Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:



15
16
17
18
# File 'app/uploaders/kuhsaft/asset_brick_asset_uploader.rb', line 15

def store_dir
  model_identifier = model.class.name.underscore.gsub(/^kuhsaft/, 'cms')
  "uploads/#{model_identifier}/#{mounted_as}/#{model.id}"
end