Sha256: f3f7b12de652efb119d6231609032e50f130318484b698955c5614c045fb8046

Contents?: true

Size: 888 Bytes

Versions: 30

Compression:

Stored size: 888 Bytes

Contents

# encoding: utf-8

class FileUploader < CarrierWave::Uploader::Base

  # 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_white_list
    %w(*)
  end

  # A string of file extensions acceptable for the uploader.
  # (passed to uploadify)
  #
  def file_ext(delimiter= ';')
    extension_white_list.map {|ext| "*.#{ext}" }.join(delimiter)
  end

  # Description of file types acceptable for the uploader
  # (passed to uploadify)
  #
  def file_desc
    "All Files (#{file_ext(',')})"
  end

  def filename
    super.presence || path.present? && path.split('/').last
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
e9_crm-0.1.13 app/uploaders/file_uploader.rb
e9_crm-0.1.12 app/uploaders/file_uploader.rb
e9_crm-0.1.11 app/uploaders/file_uploader.rb
e9_crm-0.1.10 app/uploaders/file_uploader.rb
e9_crm-0.1.8 app/uploaders/file_uploader.rb
e9_crm-0.1.7 app/uploaders/file_uploader.rb
e9_crm-0.1.6 app/uploaders/file_uploader.rb
e9_crm-0.1.5 app/uploaders/file_uploader.rb
e9_crm-0.1.4 app/uploaders/file_uploader.rb
e9_crm-0.1.1 app/uploaders/file_uploader.rb