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.34 app/uploaders/file_uploader.rb
e9_crm-0.1.33 app/uploaders/file_uploader.rb
e9_crm-0.1.32 app/uploaders/file_uploader.rb
e9_crm-0.1.31 app/uploaders/file_uploader.rb
e9_crm-0.1.30 app/uploaders/file_uploader.rb
e9_crm-0.1.29 app/uploaders/file_uploader.rb
e9_crm-0.1.28 app/uploaders/file_uploader.rb
e9_crm-0.1.27 app/uploaders/file_uploader.rb
e9_crm-0.1.26 app/uploaders/file_uploader.rb
e9_crm-0.1.25 app/uploaders/file_uploader.rb
e9_crm-0.1.24 app/uploaders/file_uploader.rb
e9_crm-0.1.23 app/uploaders/file_uploader.rb
e9_crm-0.1.22 app/uploaders/file_uploader.rb
e9_crm-0.1.21 app/uploaders/file_uploader.rb
e9_crm-0.1.20 app/uploaders/file_uploader.rb
e9_crm-0.1.19 app/uploaders/file_uploader.rb
e9_crm-0.1.18 app/uploaders/file_uploader.rb
e9_crm-0.1.17 app/uploaders/file_uploader.rb
e9_crm-0.1.16 app/uploaders/file_uploader.rb
e9_crm-0.1.14 app/uploaders/file_uploader.rb