Sha256: 4398eeb0833b3831924af003fa287e93eda7759874062e5365f0636ae58087bb

Contents?: true

Size: 471 Bytes

Versions: 3

Compression:

Stored size: 471 Bytes

Contents

module C80Catoffers

  class PriceUploader < CarrierWave::Uploader::Base

    storage :file

    def filename
      if original_filename
        "price_#{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


    def store_dir
      'uploads/prices'
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
c80_catoffers-0.1.0.8 app/uploaders/c80_catoffers/price_uploader.rb
c80_catoffers-0.1.0.7 app/uploaders/c80_catoffers/price_uploader.rb
c80_catoffers-0.1.0.6 app/uploaders/c80_catoffers/price_uploader.rb