Sha256: 6e57d3fd0d20f81f2e56d8899a632ef3f460d1f4c60c1fae98855adede5ca1f7
Contents?: true
Size: 628 Bytes
Versions: 4
Compression:
Stored size: 628 Bytes
Contents
module C80Contest class BidPhotoUploader < ::CarrierWave::Uploader::Base include ::CarrierWave::MiniMagick storage :file process :resize_to_limit => [1024,1024] version :thumb do process :resize_to_fit => [500,500] end def store_dir 'uploads/bids/' end def filename if original_filename "photo_#{secure_token(4)}.#{file.extension}" end end protected def secure_token(length=16) var = :"@#{mounted_as}_secure_token" model.instance_variable_get(var) or model.instance_variable_set(var, SecureRandom.hex(length/2)) end end end
Version data entries
4 entries across 4 versions & 1 rubygems