Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

How to: use callbacks

cowboyd edited this page · 3 revisions
Clone this wiki locally

How to: Use Callbacks

Callbacks allow you to hook in your own code when a particular CarrierWave event occurs. The following callbacks are available for use in CarrierWave uploaders:

  • :cache
  • :retrieve_from_cache
  • :store
  • :retrieve_from_store
  • :remove

Example

class MyUploader < CarrierWave::Uploader::Base
  #....
  after :cache, :unlink_original

  def unlink_original(file)
    return unless delete_original_file
    file.delete if version_name.blank?
  end
end
Something went wrong with that request. Please try again.