Skip to content

Instantly share code, notes, and snippets.

@hedgesky
Created April 9, 2016 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hedgesky/3823f2e66193b049786fc2e9edd9a242 to your computer and use it in GitHub Desktop.
Save hedgesky/3823f2e66193b049786fc2e9edd9a242 to your computer and use it in GitHub Desktop.

Recreating versions with :from_version dependency

Imagine you have a version with :from_version:

class MyUploader < CarrierWave::Uploader::Base

  version :thumb do
    process resize_to_fill: [280, 280]
  end

  version :small_thumb, from_version: :thumb do
    process resize_to_fill: [20, 20]
  end

end

In this case, when you call recreate_versions!(:small_thumb), both :small_thumb and :thumb versions will be recreated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment