Sha256: 2f7eac0c3bb437b2fbb2b3d3e8fbf371923ee1c5ba508bcc4b06e28f4e468b02

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

class <%= class_name %>Uploader

  include CarrierWave::Uploader

  # Include RMagick or ImageScience support
  #     include CarrierWave::RMagick
  #     include CarrierWave::ImageScience

  # Choose what kind of storage to use for this uploader
  storage :file
  #     storage :s3

  # Process files as they are uploaded.
  #     process :scale => [200, 300]
  #
  #     def scale(width, height)
  #       # do something
  #     end

  # Create different versions of your uploaded files
  #     version :thumb do
  #       process :scale => [50, 50]
  #     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(jpg jpeg gif png)
  #     end

  # Override the filename of the uploaded files
  #     def filename
  #       "something.jpg"
  #     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
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
jnicklas-carrierwave-0.2.2 rails_generators/uploader/templates/uploader.rb
carrierwave-0.2.1 rails_generators/uploader/templates/uploader.rb