Sha256: cd95517249295e661dfb5026af46cdceb95997a2fc03d7a97d7851429f6e3405

Contents?: true

Size: 682 Bytes

Versions: 2

Compression:

Stored size: 682 Bytes

Contents

# encoding: utf-8
module Fae
  class FileUploader < CarrierWave::Uploader::Base

    include CarrierWave::MiniMagick

    process :save_file_size_in_model

    def save_file_size_in_model
      model.file_size = file.size
    end

    # 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
      "system/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
      %w(jpg jpeg gif png pdf)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fae-rails-2.2.0 app/uploaders/fae/file_uploader.rb
fae-rails-2.1.0 app/uploaders/fae/file_uploader.rb