Sha256: e327150e77d1e76ef2a340c8f6ea316a2bbcc762dbd1e484c26bd868546b1e6c
Contents?: true
Size: 590 Bytes
Versions: 2
Compression:
Stored size: 590 Bytes
Contents
module Ecom module Core class PhotoUploader < CarrierWave::Uploader::Base storage :file def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end def extension_whitelist %w[jpg jpeg gif png] end def filename "#{secure_token}.#{file.extension}" if original_filename.present? end protected def secure_token var = :"@#{mounted_as}_secure_token" model.instance_variable_get(var) || model.instance_variable_set(var, SecureRandom.uuid) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ecom_core-1.2.35 | app/uploaders/ecom/core/photo_uploader.rb |
ecom_core-1.2.34 | app/uploaders/ecom/core/photo_uploader.rb |