Sha256: 5138ad50d56e043e809a9c080c9873d3dba627a6abeae505a39ebb975a1bf3d8

Contents?: true

Size: 746 Bytes

Versions: 36

Compression:

Stored size: 746 Bytes

Contents

module C80MapFloors

  # TODO:: FloorImageUploader класс должен использоваться только для загрузки img_bg [потому что 78aasq]

  class FloorImageUploader < CarrierWave::Uploader::Base

    include CarrierWave::MiniMagick

    storage :file

    version :thumb do
      process :resize_to_fit => [500,500]
    end

    def store_dir
      "uploads/map/floors"
    end

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

36 entries across 36 versions & 1 rubygems

Version Path
c80_map_floors-0.1.0.16 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.15 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.14 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.13 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.12 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.11 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.10 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.9 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.8 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.7 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.6 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.5 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.4 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.3 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.2 app/uploaders/c80_map_floors/floor_image_uploader.rb
c80_map_floors-0.1.0.1 app/uploaders/c80_map_floors/floor_image_uploader.rb