Sha256: 6fa77cd5f3fe141d749702769f511392382488ef004c327e47a353ba56d4f89a

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

class ::FileUploader < Shrine

  Attacher.derivatives do |original|
    result = {
    }

    if context[:record].media_type == 'image'
      result = Cas::RemoteCallbacks.callbacks[:uploaded_image_versions].call(original)
    end

    Rails.logger.info "FileUploader, versions: [#{result.keys.join(", ")}]"
    result
  end

  def generate_location(io, context)
    year  = Time.now.strftime("%Y")
    month = Time.now.strftime("%m")
    original_filename = context[:metadata]["filename"]

    # the default unique identifier
    name = "#{SecureRandom.hex[0..6]}-#{original_filename}"

    [year, month, name].compact.join("/")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cas-cms-1.0.0.alpha2 app/uploaders/file_uploader.rb