Sha256: a4df863c6891860df63ba69d2a052f40b3c5ee21a152db867eed18359069a30b
Contents?: true
Size: 654 Bytes
Versions: 10
Compression:
Stored size: 654 Bytes
Contents
# encoding: utf-8 class AssetUploader < CarrierWave::Uploader::Base # Choose what kind of storage to use for this uploader: storage Assetable.storage # Set the MD5 hash process :set_md5 # 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 if model.present? "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" else "uploads/#{mounted_as}" end end # Set an MD5 hash of the image def set_md5 if model.present? model.checksum = Digest::MD5.file(current_path).to_s end end end
Version data entries
10 entries across 10 versions & 1 rubygems