Read more

Carrierwave processing facts

Dominik Schöler
February 21, 2019Software engineer at makandra GmbH
  1. Class-level process definitions are only applied to the original file
  2. Versions are generated based on the processed original file
  3. Callbacks (before/after) are applied to original file and each version by itself
  4. Under the hood, a version is an instance of the uploader class that has no versions
  5. Version uploader and original uploader can be distinguished by checking #version_name: version uploaders return the version name, whereas the original uploader instance returns nil
  6. Version instances do not have a reference to their parent uploader
class DemoUploader < CarrierWave::Uploader::Base

  process :resize # 1

  before :cache, :do_something # 3

  version :thumb do # 2
    process :crop
  end

  private

  def do_something(file)
    case version_name # 5
    # ...
  end

end
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot
Posted by Dominik Schöler to makandra dev (2019-02-21 16:26)