Sha256: 79a55ca8004d38cda53e5410a3dc53f58cd54d8a5191b1dd71232a782baecb89

Contents?: true

Size: 679 Bytes

Versions: 16

Compression:

Stored size: 679 Bytes

Contents

# encoding: utf-8
require 'carrierwave/processing/mime_types'

module Qbrick
  class AssetBrickAssetUploader < CarrierWave::Uploader::Base
    include CarrierWave::MimeTypes
    storage :file

    process :set_content_type
    process :save_content_type_and_size_in_model

    def save_content_type_and_size_in_model
      model.content_type = file.content_type if file.content_type
      model.file_size = file.size
    end

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

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
qbrick-2.7.1 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.7 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.10 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.9 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.8 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.7 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.6 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.5 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.4 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.3 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.2 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.1 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.6.0 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.5.2 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.5.1 app/uploaders/qbrick/asset_brick_asset_uploader.rb
qbrick-2.5.0 app/uploaders/qbrick/asset_brick_asset_uploader.rb